Remove ‘product’ & ‘product-cateogory’ from url – woocommerce [closed]

Found this neat little article on it, try this out!

http://ryansechrest.com/2013/04/remove-post-type-slug-in-custom-post-type-url-and-move-subpages-to-website-root-in-wordpress/

It’s a guide/tutorial, so you should be able to get more information on what’s going on here if you visit his site.

By the way, it’s against the rules to ask for a plugin here.

add_action(
  'pre_get_posts',
  'custom_pre_get_posts'
);

function custom_pre_get_posts($query) {
    global $wpdb;

    if(!$query->is_main_query()) {
      return;
    }

    $post_name = $query->get('pagename');

    $post_type = $wpdb->get_var(
      $wpdb->prepare(
        'SELECT post_type FROM ' . $wpdb->posts . ' WHERE post_name = %s LIMIT 1',
        $post_name
      )
    );

    switch($post_type) {
      case 'services':
        $query->set('services', $post_name);
        $query->set('post_type', $post_type);
        $query->is_single = true;
        $query->is_page = false;
        break;
    }

    return $query;
}