How can I do to have my product links as mysite.com/name-of-my-product?

I tried the WooCommerce options but I can't remove the base string before the product`s name from the url structure.



Add a filter for post_type_link, and change its value in a callback function.

Sample code, not tested:

add_filter( 'post_type_link', 'simple_woo_urls', 10, 2 );

function simple_woo_urls( $url, $post )
    if ( 'product' === $post->post_type )
        return home_url( $post->post_name );

    return $url;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.