How to change URL in WordPress according to taxonomy name

When I wrote a taxonomy for my WP site I made a misstake writing the name:
www.mysite.com/clubs/milan
Clubs is the taxonomy name as shown below:

add_action( 'init', 'create_book_tax' );

function create_book_tax() {
register_taxonomy(
    'player_clubs',//taxonomy name
    array( 'teams'),//CP name
    array(
        'label' => __( 'Clubs' ),
        'rewrite' => array( 'slug' => 'clubs' ),
        'hierarchical' => true,
        'show_in_nav_menus'    => true,
        'show_admin_column'    => true,
    )
);
}

Instead of having www.mysite.com/clubs/milan I would like to replace clubs into games

Read More

How can I do it?

Related posts

Leave a Reply

1 comment

  1. I don’t worked with wordpress that match but I thing the solution is the bellow code:

    add_action( 'init', 'create_book_tax' );
    function create_book_tax() {
    register_taxonomy(
        'player_clubs',//taxonomy name
        array( 'teams'),//CP name
        array(
            'label' => __( 'Clubs' ),
            'rewrite' => array( 'slug' => 'games' ),
            'hierarchical' => true,
            'show_in_nav_menus'    => true,
            'show_admin_column'    => true,
        )
    );
    }
    

    As the other users has point out, you have to flush permalinks in wordpress after you made this change. Or simply type:

    flush_rewrite_rules();
    

    after your php function call.