permalinks - How to change url for taxonomy pages?

admin2025-06-05  3

My Wordpress default category has 'news' category term. I created custom post type with name 'artist' and custom taxonomy named 'genre'. Now what I set in permalink section is below

custom structure - /news/%category%/%postname%/

because I want to open all my default post open with 'news' slug. I create page taxonomy-genre.php which lead to all post of genre taxonomy. let say genre taxonpmy has term 'afro-pop'. Now when I view the page it display all post of 'afro-pop' but problem is that it has url

http://localhost/mn2s-new/news/genre/afro-pop/

what I want is

http://localhost/mn2s-new/genre/afro-pop/

I want to remove that news slug for taxonomy-genre.php page. Please help me with this I am trying from 2 days but doesn't find any solution.

My Wordpress default category has 'news' category term. I created custom post type with name 'artist' and custom taxonomy named 'genre'. Now what I set in permalink section is below

custom structure - /news/%category%/%postname%/

because I want to open all my default post open with 'news' slug. I create page taxonomy-genre.php which lead to all post of genre taxonomy. let say genre taxonpmy has term 'afro-pop'. Now when I view the page it display all post of 'afro-pop' but problem is that it has url

http://localhost/mn2s-new/news/genre/afro-pop/

what I want is

http://localhost/mn2s-new/genre/afro-pop/

I want to remove that news slug for taxonomy-genre.php page. Please help me with this I am trying from 2 days but doesn't find any solution.

Share Improve this question edited Dec 13, 2018 at 15:49 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Dec 13, 2018 at 5:51 Krishna thakorKrishna thakor 11 silver badge3 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 3

This is controlled by the with_front argument in your taxonomy registration code:

register_taxonomy(
    'genre',
    'artist',
    array(
        'rewrite' => array(
            'slug' => 'genre',
            'with_front' => false, // don't prepend static prefix from post permalink
        ),
        // your other args...
    )
);
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749102030a316376.html

最新回复(0)