我使用了自定义结构/blog/%category%/%postname%/
用于博客。此外,我还有一个名为“FAQ”的自定义帖子类型,在查看FAQ帖子时,它会显示/blog/faq/%faq_category%/%postname%/
. 当我使用[\'with_front\' => false]
分页URL(“旧条目”和“新条目”链接)http://www.example.com/faq/page/2/
总是显示出404 page.
在使用自定义帖子类型时,如何避免以“博客”开头的固定链接?
1 个回复
SO网友:entreprenerds
使用自定义帖子类型,has_archive 默认值为false-这需要显式设置为true。
此外,在您的rewrite 参数,您可能需要设置:
\'pages\' => true
“pages”应默认为true,但如果您在其他地方将其关闭,可能需要显式设置?最后,如果要在插件中注册post类型,请在激活和停用挂钩中调用flush\\u rewrite\\u rules()。
我希望这有帮助!有关这些参数的所有详细信息可在此处找到:
http://codex.wordpress.org/Function_Reference/register_post_type
结束