Remove Post Type Slug from URLs

I’ve been asked about how to do it probably a million times. The question is how to make the URLs of your custom post types (or WooCommerce products) to look like Pages.

For example how to have instead of

In this tutorial I am going to provide you a complete guide! As an example we are going to remove /product/ from WooCommerce product URLs. But before we begin I would like to warn you that you have to avoid it if possible, because it may slows down the overall performance of your website and you have to be extra-careful when assigning a specific slug for your posts.

Day 1. Leave no Chance to Find Out your Administrator Login

Remove taxonomy slugs (categories, post tags and custom taxonomies) from URL

In this post I will show you how to remove «category» from WordPress categories URL,

How to remove category slug from URLs

how to remove «tag» from post tags URLs,

How to remove tag from post_tags URLs.

and how to remove custom taxonomy slugs

Permalink post_type structure with taxonomy slug in it

Let’s look at the simple example of a eshop on WordPress.

The shop has custom post type product and category for products product_cat. By default product links looks like

How to Change URL of a custom post / page / category / tag in theme functions.php. Capitalize URL.

If you read this post, you should know something about WP_Rewrite class. It allows you to change WordPress permalinks rewrite reules, change the structure of them.

In this post I won’t use WP_Rewrite, I just want to show you another way of