0
votes

I have a custom post type called product and a custom taxonomy for products called product_types, which is hierarchical, so I have sub-categories in it.

I want the permalink to show up as http://mysite.com/product_type/sub_category/postname

I tried a lot of plugins and things I found online, nothing worked so far.

Thank you.

1
Yes, I did search, none of the solutions worked for me.aghoshx
Doesn't work is not a useful description. Enable the debug mode and write down what exactly went wrong.fuxia
Okay, it did not work - nothing changed, no errors or anything. It just won't make a difference.aghoshx

1 Answers

1
votes

firstly I would double check the function which is creating your custom post type, within that function there should be an element called: rewrite

ie:

register_post_type( 'products',
   'menu_position' => 25, // below pages
   'public' => true,
   'show_ui' => true,
   'rewrite' => array( 'slug' => 'product' ) <-- this is what you need!
);

also check the register_taxonomy function for the same!

ie:

 register_taxonomy(
  'team',array('product_types'), 
    array(
    'public' => true,
    'show_ui' => true,
    'show_in_nav_menus' => true,
    'query_var' => true,
    'hierarchical' => true, <-- this is needed!
    'rewrite' => true <-- this is what you need!
  )); 

the only thing left to check is:

your permalink structure is set to /%postname%/ you may have to reset to default, save it, then re-set to /%postname%/ and save,

hope that helps :)

Marty