我有一个Wordpress网站设置了自定义帖子类型和自定义分类和自定义URL。然而,当我转到:
/custom-post-type/custom-taxonomy/custom-taxonomy-sub/postname
它是404。我已经尝试了所有方法,只想创建一个重定向,该重定向获取邮政编码并将其传递给single-custom taxonomy.php,而不更改URL。
使用类似于/custom- post -type/(.*)的正则表达式进行某种重定向,并将第三个匹配作为变量传递给single-custom-taxonomy.php,这样它就可以获得post页面。
我该怎么做呢?
发布于 2016-08-25 19:08:58
弄清楚了:
函数custom_rewrite_basic() { add_rewrite_rule('^knowledge-center/(.*)/(.*)/(.*)','index.php?pagename=post_type=questions&questions=$matches3','custom_rewrite_basic');} add_action('init',‘custom_rewrite_basic’);
https://stackoverflow.com/questions/39134109
复制相似问题