We have a pretty complicated site that has a lot of different custom post types. Each of the post types has an array of custom fields and stuff like that. Also I have added the ability to organize all of our custom posts using the "posts" categories and tags. I am thinking about changing the permalink structure to allow "category" to be displayed before postname.

Are there any issues with across the board sharing permalink structure across post types?

Therefore we might have post types - product-specs, product-docs, product-installation.

And I would see permalink structure:





Given that this structure is OK is there an easy way to make all custom post types default to the WP settings for permalinks? ** Note that I understand how to register a different permalink structure for a given custom post type (which has been answered many times here) but not how to make any new custom post type default to the WP settings - in case custom post types are made without me knowing.

1 Answer 1


There are definitely some issues, I'd question what exactly you'd gain from having the same structure for all.

You could create conflicts if you have two different posts with the same slug. There would be nothing enforcing slug uniqueness between post types, so you'd have to write that code yourself to run whenever a post is saved or updated.

You'll need a post_type_link filter to generate the URLs with categories when any permalink API function is called.

You'll have to modify the queries via pre_get_posts to have WordPress look in all post types for the requested slug. I'm not sure what performance impact this may have, as it's an IN on multiple values rather than a straight post_type =.

As for the structure when you register the post type- the rules you'd need would already exist (they were created for the built in post type), so having more of the same rules generated is redundant. In that case it's probably best to just set rewrite to false for all post types.

Personally I would make the leading products segment unique for each type. You can still have the categories in all of them.

  • The thing is it is more of a knowledgebase. So product1 might have 50-200 different custom posts associated with it. As we find more ways to categorize our documentation we create more custom post types to handle different sets of data. I would like a user to go the products1 page and see all of the custom types associated with products1. Does that make sense? If there is an easier/better way to do it I am all ears.
    – STing
    Commented Oct 12, 2015 at 6:03
  • Also you make a good point on the slugs. This seems like there would be a lot of different things I would need to think about... I am guessing that my only option is really to use tags but the problems with tagging is that they aren't hierarchical and not sure that would differentiate things enough.
    – STing
    Commented Oct 12, 2015 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.