0

Have a wordpress Website in development a theme which has following url for a services

url for custom page type :

localhost/website/service/mechanical-engineering/
localhost/website/service/automotive-parts-systems/

need to change it to :

localhost/website/product/mechanical-engineering/
localhost/website/product/automotive-parts-systems/

I am not able to change it in permalinks, also i am a designer and know little about php

Have tried changing page name and tags in permalinks also not able to find any plugin which can do this

1 Answers1

0

You can change your post type slug using register_post_type_args filter.

try out these code in your theme functions.php.

function change_post_types_slug( $args, $post_type ) {
   /*item post type slug*/   
   if ( 'service' === $post_type ) {
      $args['rewrite']['slug'] = 'product';
   }
   return $args;
}
add_filter( 'register_post_type_args', 'change_post_types_slug', 10, 2 );

Then save permalink Settings => permalink => save.

theboss_dev
  • 1,152
  • 1
  • 8
  • 21