How to add a sub directory to WordPress single posts without affecting other post types?

I've been trying to add a subdirectory to my blog post's permalink for example domain.com/blog/post-slug/

However, this is affecting the other post types that I've created using Pods such as domain.com/knowledgebase/ is now domain.com/blog/knowledgebase/

I would appreciate anyone helping me solve this problem. I still just want a blog as a subdirectory for my posts but I need the other post types not affected by that change.

Topic pods-framework directory permalinks custom-post-types Wordpress

Category Web


If we look at the register_post_type documentation, in the rewrite option, there is a sub-option that controls this:

'with_front' => bool Should the permalink structure be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true

So something like this:

    ...
    'rewrite' => [ 'with_front' => false ],
    ...

More information on register_post_type rewrite options

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.