$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>permalinks - How to change url for taxonomy pages?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

permalinks - How to change url for taxonomy pages?

matteradmin9PV0评论

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...
    )
);
Post a comment

comment list (0)

  1. No comments so far