Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to change taxonomy slug in wordpress

function space_change_custom_taxonomy_slug_args( $taxonomy, $object_type, $args ){
    if( 'old-slug' == $taxonomy ){ // Instead of the "old-slug", add current slug, which you want to change.
        remove_action( current_action(), __FUNCTION__ );
        $args['rewrite'] = array( 'slug' => 'new-slug' ); // Instead of the "new-slug", add a new slug name.
        register_taxonomy( $taxonomy, $object_type, $args );
    }
}
add_action( 'registered_taxonomy', 'space_change_custom_taxonomy_slug_args', 10, 3 );
 
PREVIOUS NEXT
Tagged: #change #taxonomy #slug #wordpress
ADD COMMENT
Topic
Name
2+1 =