简体   繁体   English

WordPress的重写规则不起作用?

[英]Wordpress rewrite rule not working?

I am trying to implement some rewrite rules on a wordpress website to rewrite my urls like: 我正在尝试在wordpress网站上实施一些重写规则,以重写我的网址,例如:

glossary/?terms=a 词汇表/?terms = a

to

glossary/terms/a 词汇/术语/

I have added the following code to my functions.php and have flushed the rewrites but havent had no luck? 我已经将以下代码添加到我的functions.php中,并刷新了重写内容,但是还没有运气吗?

add_rewrite_rule('^glossary/([0-9]+)/?', 'glossary/?terms=$matches[1]', 'top');

Can anyone point me in the right direction or advise what is incorrect with the above? 谁能向我指出正确的方向或提出上述错误的建议?

设法使它与以下重写规则一起使用:

add_rewrite_rule('^glossary/term/([a-z]+)/page/([0-9]+)/?$', 'index.php?post_type=glossary&terms=$matches[1]&paged=$matches[2]', 'top');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM