0

I use Custom Post Type UI plugin to create new post types and taxonomies.

I created post type cpt_recipes

"has_archive" => "recipes",
"rewrite" => [ "slug" => "recipe", "with_front" => true ],

First taxonomy cpt_recipes_cat

"hierarchical" => true,
"rewrite" => [ 'slug' => 'recipes/category', 'with_front' => true,  'hierarchical' => true, ],

Second taxonomy cpt_recipes_ingredient

"hierarchical" => true,
"rewrite" => [ 'slug' => 'recipes/ingredient', 'with_front' => true,  'hierarchical' => true, ],

Now how to remove /category and /ingredient from the taxonomy archive url and make it work?

Or how to remove only /category from the first taxonomy archive url and make it work?

3
  • Not clear what is not working? What are you trying to achieve? Need more detials & possibly code.
    – Mulli
    Commented Mar 15, 2021 at 21:29
  • I want to remove taxonomy slug from single term archive url. I want to eg. cpt_recipes_cat term archive url to look like /recipes/category-name/ and for cpt_recipes_ingredient term archive url /recipes/ingredient-name/. At now when I remove from rewrite rule /category or /ingredient I gets Error 404 at term archive.
    – Avigo
    Commented Mar 17, 2021 at 9:41
  • Please look at admin panel settings, at link structure. I think you should handle it there
    – Mulli
    Commented Mar 17, 2021 at 13:03

0

Your Answer

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