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

WordPress Development Asked by Joboy2212 on November 14, 2020

I’ve been trying to add a subdirectory to my blog post’s permalink for example

However, this is affecting the other post types that I’ve created using Pods such as is now

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.

One Answer

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

Answered by Tom J Nowell on November 14, 2020

Add your own answers!

Related Questions

CREATE TABLE with dbDelta does not create table

1  Asked on October 30, 2021 by fcd


how to add shortcode widget at end of main blog page

1  Asked on October 30, 2021 by shubhamk


Placing background image over section divider

1  Asked on October 30, 2021 by user191925


jQuery Click event is not fired at all

1  Asked on October 30, 2021 by islam-hanafi


Make the product page as homepage WooCommerce

0  Asked on October 30, 2021 by gabriel-borges


How to be sure to get last page version without ANY cache?

2  Asked on October 30, 2021 by j-bizmai


How to grab posts in Gutenberg Block?

1  Asked on October 30, 2021 by stephen-sabatini


Custom post type permalink returns bad url

1  Asked on October 30, 2021 by ncti


Menus don’t appear in admin area / WordPress Multisite

0  Asked on October 30, 2021 by user191642


Client side HTTP parameter pollution (reflected)

0  Asked on October 30, 2021 by divided


WP Ajax Function Always Returning undefined

1  Asked on October 30, 2021 by brian-bruman


Group Posts by Category in Monthly Archive

2  Asked on October 30, 2021 by zero-goki


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir