Title: Same slug for multiple custom post types
Last modified: June 8, 2020

---

# Same slug for multiple custom post types

 *  Resolved [webteamap](https://wordpress.org/support/users/webteamapergy/)
 * (@webteamapergy)
 * [6 years ago](https://wordpress.org/support/topic/same-slug-for-multiple-custom-post-types/)
 * Does anyone know how to create the same slug for multiple custom post types? 
   I am trying to make products_inner and products post type start with the slug:
   products. This is what I tried. I got a 404 for products page but the products_inner
   page worked though.
 * This is what I am adding also to achieve the hierarchy of pages. products slug;/%
   field_product_category%/%field_brand%/%postname%/
 * products_inner slug: /%field_product_category%/%field_product_high_level%/%postname%/
 * Functions.php
 * add_filter( ‘register_post_type_args’, ‘wpse247328_register_post_type_args’, 
   10, 2 );
    function wpse247328_register_post_type_args( $args, $post_type ) {
 *  if ( ‘product_inner’ === $post_type ) {
    $args[‘rewrite’][‘slug’] = ‘products’;}
 *  return $args;
    }

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [6 years ago](https://wordpress.org/support/topic/same-slug-for-multiple-custom-post-types/#post-12956168)
 * To clarify, you have the actual slugs being different, but when it comes to permalinks,
   you want both to be queried for with just permalink slug of “products” ? Say `
   https://mydomain.com/products/some-product/`
    -  This reply was modified 6 years ago by [Michael Beckwith](https://wordpress.org/support/users/tw2113/).
 *  Thread Starter [webteamap](https://wordpress.org/support/users/webteamapergy/)
 * (@webteamapergy)
 * [6 years ago](https://wordpress.org/support/topic/same-slug-for-multiple-custom-post-types/#post-12956841)
 * Hello. No in the custom fields I set them all to have products as the rewrite_slug.
   I have images, can i email them to you? But when i try to view them the pages,
   i get 404. I want to to be a hierarchy.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [6 years ago](https://wordpress.org/support/topic/same-slug-for-multiple-custom-post-types/#post-12961400)
 * Perhaps instead of setting up multiple post types and trying to tie them all 
   together, instead just have 1 post type and set it to be hierarchical so that
   you still get that parent/child relationship going. Beyond that, I suspect whatever
   you’re trying to achieve will take a lot of query customization to make work,
   which is outside the scope of what CPTUI handles directly.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Same slug for multiple custom post types’ is closed to new replies.

 * ![](https://ps.w.org/custom-post-type-ui/assets/icon-256x256.png?rev=2744389)
 * [Custom Post Type UI](https://wordpress.org/plugins/custom-post-type-ui/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-post-type-ui/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-type-ui/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-type-ui/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-type-ui/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-type-ui/reviews/)

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [slug](https://wordpress.org/support/topic-tag/slug/)

 * 3 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/same-slug-for-multiple-custom-post-types/#post-12961400)
 * Status: resolved