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/project_category/%category%/
What I want is:
example/stainless-steel-products/%category%/
I have changed the slug of the project archive so that example/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!
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!
Share Improve this question edited Mar 17, 2021 at 6:40 Aran Joyce asked Mar 15, 2021 at 5:38 Aran JoyceAran Joyce 131 silver badge4 bronze badges2 Answers
Reset to default 2add_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;
}
You can use this Plugin:
https://wordpress.org/plugins/custom-post-type-permalinks/
It works fine. U only need also to add this in function php:
// 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' );