Divi change project category slug

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!

Topic child-theme url-rewriting php permalinks Wordpress

Category Web


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' );

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;
}

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.