最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

add all blog posts to folder

programmeradmin6浏览0评论

I want to add all the blog posts to the /blogs/the-post-name type structure. I can do this through the permalinks settings with:

/blogs/%postname%/

but this also affects custom post types resulting in a

/blogs/custom-post-type/the-custom-post-type-name

How can i add all posts into the blogs folder without adding all my custom post types into the blogs folder?

I want to add all the blog posts to the /blogs/the-post-name type structure. I can do this through the permalinks settings with:

/blogs/%postname%/

but this also affects custom post types resulting in a

/blogs/custom-post-type/the-custom-post-type-name

How can i add all posts into the blogs folder without adding all my custom post types into the blogs folder?

Share Improve this question asked Jul 27, 2020 at 1:35 Daniel FloridoDaniel Florido 31 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

When registering the custom post types, set with_front to false:

register_post_type(
    'my_post_type',
    [
        // ...etc.
        'rewrite' => [
            'with_front' => false,
        ],
    ]
);

The post type URL will then not include anything extra you've added in the Permalinks settings.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论