How to change taxonomy urls in wordpress?
Following along with this question and this one
But can not get the desired outcome.
The default is:
example.com/project_category/%category%/
What I want is:
example.com/stainless-steel-products/%category%/
I have changed the slug of the project archive so that example.com/stainless-steel-products/ is the project archive.
Below is the code used to achieve that.
// Change peralinks projects
function custom_project_slug () {
return array(
'feeds' => true,
'slug' => 'stainless-steel-products',
'with_front' => false,
);
}
add_filter( 'et_project_posttype_rewrite_args', 'custom_project_slug' );
?>
How do I change the slug of the project categories so that it is a child of the project archive?
Thanks for any help in advance!
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
add_filter( 'register_taxonomy_args', 'change_taxonomies_slug', 10, 2 );
function change_taxonomies_slug( $args, $taxonomy ) {
if ( 'project_category' === $taxonomy ) {
$args['rewrite']['slug'] = 'stainless-steel-products';
}
return $args;
}
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0