skip to Main Content

I have at the moment url in product view: https://mywebsite.com/product/product-name

Shop url looks like this: https://mywebsite.com/shop

I need to change product view url like https://mywebsite.com/products/product-name

I didnt find any settings for that.

2

Answers


  1. I tried this, It is working fine for me

    let me know your thoughts..

    function change_post_types_slug( $args, $post_type ) {   
       if ( 'product' === $post_type ) {
          $args['rewrite']['slug'] = 'products';
       }
       return $args;
    }
    add_filter( 'register_post_type_args', 'change_post_types_slug', 10, 2 );
    
    Login or Signup to reply.
  2. Permalink structure like the following screenshot will give the intended result.

    Permalink Structure
    Link to image: https://snipboard.io/xGJWK6.jpg

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search