Search code examples
wordpressurl-rewritingpermalinkstaxonomy

Add word to custom taxonomy slug in WordPress


I want to add a specific word to every taxonomy archive.

I've this domain:

http://example.com/brand/nike/

And I want it to look like this:

http://example.com/nike-shop/

Is there any way to add the word "shop" to the slug and remove the taxonomy name (brand)? I've checked to codex but I couldn't find anything.

EDIT: Changed the question to make it more clear


Solution

  • If you're using your custom taxonomy, you can try to add rewrite parameter to the code, like this:

    register_taxonomy('taxonomy',
        array('post'),
        array(
    
            ...
    
            'rewrite' => array(
                'slug' => 'taxonomy-archive'
            )
        )
    );
    

    But once you change your code, do not forget to go to Settings-Permalinks and just click Save Changes button there.

    If you can not affect on the register_taxonomy() function, you can try the solution based on this tutorial https://rudrastyh.com/wordpress/remove-taxonomy-slug-from-urls.html