英文:
how do i pass url parameter after page name in wordpress
问题
我有一个页面的URL localhost://testing/partners,在这里我需要在页面名称后传递参数,如 localhost://testing/partners/category/abcd 或 localhost://testing/partners/details/xyz,但当我在页面名称后添加参数时,出现404页面未找到的错误。
而且我也需要获取这些参数。我已经尝试过了,但没有成功。
add_rewrite_rule('^partners/([^/]+)/?', 'index.php?pagename=partners&$matches[1]', 'top');
英文:
I have a page url localhost://testing/partners, here i need to pass parameters after page name like. localhost://testing/partners/category/abcd or localhost://testing/partners/details/xyz
but when i am adding parameter after page name getting error 404 page not found.
and also i need to fetch that parameters. i have tried but its not working.
add_rewrite_rule( '^partners/([^/]+)/?', 'index.php?pagename=partners&$matches[1]', 'top' );
答案1
得分: 2
如果您想为自定义分类创建文章名称,您可以在WordPress仪表板的永久链接设置中进行这些更改。
设置->永久链接
参考链接:
https://wordpress.org/documentation/article/settings-permalinks-screen/
英文:
@initial
If you are trying to create post names for custom categories, you can make these changes in the Permalink Settings from the WordPress Dashboard.
Settings->Permalinks
Reference:
https://wordpress.org/documentation/article/settings-permalinks-screen/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论