我想将所有博客文章添加到/ blog /-post-name类型结构中。我可以通过permalinks设置这样做:
/blogs/%postname%/
但是,这也会影响自定义post类型,从而导致
/blogs/custom-post-type/the-custom-post-type-name
如何将所有帖子添加到blog文件夹中,而不将所有自定义的帖子类型添加到blog文件夹中?
发布于 2020-07-27 01:41:09
注册自定义post类型时,将with_front设置为false:
register_post_type(
'my_post_type',
[
// ...etc.
'rewrite' => [
'with_front' => false,
],
]
);post类型的URL将不包括您在Permalinks设置中添加的任何额外内容。
https://wordpress.stackexchange.com/questions/371820
复制相似问题