Removing product, product-category from WooCommerce URLs

The permalinks are an essential part of any WooCommerce store's SEO performance. Unfortunately, WordPress does not offer much freedom for customizing its URLs. Fortunately, there are simple solutions to work around this, and this article explains them.

A common issue is the extra permalink base that WooCommerce automatically includes. It makes URLs longer than necessary and does not add much real value to the site’s structure.

In WordPress, each of custom post types and taxonomies need their own unique permalink base (like “/product/” or “/product-category/”). This helps WordPress properly identify and load the right content.

Some users attempt to remove this through WordPress settings, but that can create rewrite rules conflicts and cause pages to break with 404 errors. To get rid of the extra base without issues, you will need to use a plugin or write a custom code snippet.

 

Remove product, product-category from WooCommerce URLs

Default Structure and SEO Implications

Although, the URL length does not seem to affect the position in search results, it might affect the users experience in search results and therefore the amount of organic traffic.

In general, the shorter URLs tend to outperform longer ones in search results by cleaner appearance in search results and enhancing click-through rates. As of now, the search engines display in results pages only around 65-75 characters of a URL.

So, how is this related to WooCommerce permalinks? Let's take a moment to see what these URLs usually look like by default. By default, the WooCommerce content type items' URLs follow this pattern:

  • Products:
    /product/product-name/
  • Categories:
    /product-category/category-name/
  • Tags:
    /product-tag/tag-name/

As you can see above, the URLs for each content type have an extra part ("/product/", "/product-tag/", and "/product-category/") that does not add much meaning, making the URL longer.

Default WooCommerce permalink settings
The built-in settings available under "Settings -> Permalinks" panel.

Longer URLs get truncated, potentially hiding relevant information. Therefore, a flatter, more concise structure like /smartphones/iphone-case/ can provide clearer context and attract more visitors.

A common and simple way to make WooCommerce URLs shorter is by getting rid of that extra part, which is explained later in the article.

SEO Implications

As already stated, the URLs are an important element of your SEO strategy and should be analyzed with care. When a WooCommerce website is brand new, changing the permalinks will not harm its SEO since there’s little or no organic traffic and backlinks to be concerned about.

However, for established stores, rewriting existing URLs requires careful analysis. In most cases, the URLs with lots of backlinks, social shares, and strong search engine authority should generally keep their structure.

If you converted from another CMS (for example, Magento) to WooCommerce, your new permalinks will very likely not match the previous URL formats. While your new shop URLs will almost certainly be less optimized and lengthier than the previous ones, Permalink Manager allows you to recover their former structure.

Rewrite Rules Conflict

Some developers suggest setting the base slug for WooCommerce content types to a single dot ('.') to remove it. While it might seem to work at first, it actually overrides other rewrite rules, which can break links, display incorrect content, or make some pages inaccessible.

Remove product-category base

If you use the same permalink base (like "product") for different content types or remove it completely in built-in permalinks settings, WordPress will not be able detect the permalinks correctly.

This can lead to one of two issues:

  1. It might mistakenly interpret pages' or posts' permalinks as WooCommerce products or categories, causing 404 errors.
  2. WordPress may ignore rewrite rules for WooCommerce content types, which can prevent products or categories from loading correctly.

This is a common issue, but the official documentation only touches on it briefly. What is more surprising is that while there are plenty of discussions on WordPress.org and other platforms, very few actually explain why removing the base this way does not work:

If you want to understand why removing the base slug this way can lead to problems, we have a detailed article that explains it.
The simplest way to prevent WooCommerce URL conflicts is to use the default permalink settings, which ensure that different content types have their own unique bases.

If you still want to remove the base, you can override the default permalinks using custom code snippet or an extra plugin such as Permalink Manager.

Because short URLs can be beneficial, it may be reasonable to remove needless "/product/", "/product-tag/", and "/product-category/" from WooCommerce URL addresses.

However, since WordPress's native permalink system doesn't support this functionality, implementing these changes requires additional plugins or custom development.

Permalink Manager can help you change WooCommerce permalinks without needing to use any custom code snippet. The Permastructure editor is a quick and simple way to do this.

Once you have installed and activated Permalink Manager Pro, go to "Tools -> Permalink Manager -> Permastructures" in the admin dashboard. From there, you can easily apply a new permalink format to multiple URLs.

Permastructures settings

The WooCommerce content types are organized in a separate subsection for your convenience. You may then modify the permastructures for Products, Product Categories, and Product Tags.

Settings for WooCommerce content types
Permastructure settings for WooCommerce content types

You may now replace the permalink bases /product/, /product-category/, and /product-tag/ with any word you choose or delete them entirely.

Permalink settings for WooCommerce content types

Please remember to save the updated options by clicking the "Save Permastructures" button at the bottom of the page.

The modified formats will be used automatically only for new permalinks. Please check the following section or this dedicated page for further information on how to use "Regenerate/reset" tool.

Remove WooCommerce Permalink Bases From Existing URLs

To make sure your product URLs reflect the new structure without permalink bases, you need to reset their custom permalinks. Go to "Tools -> Regenerate/Reset", then use the settings below:

  • Mode:
    Regenerate custom permalinks
  • Select content type:
    Post types
  • Select post types:
    Products
  • Select post statuses:
    Published
Regenerate product permalinks
Regenerate/reset subsection.

The process for resetting Product Categories and Tags is the same as for Products in the previous step. To reset their permalinks use the following settings:

  • Mode:
    Regenerate custom permalinks
  • Select content type:
    Taxonomies
  • Select post types:
    Product categories & Product tags
Regenerate WooCommerce permalinks (product categories and tags)
Form settings for “Product categories” and “Product tags”

How to Customize WooCommerce Permalinks Individually?

If you want to remove /product-category/ from WooCommerce permalinks, using "Permastructures" to bulk update them is more convenient than changing them one by one. Permalink Manager allows you to modify the shop URLs in yet another method.

When you only need to change a few products or product categories, using URI Editor is the simplest and most straightforward option. To open the URI Editor, click the "Permalink Manager" button next to the title input field.

How to edit WooCommerce permalinks using URI Editor?

The URI Editor for product categories and tags may be found at the bottom of the form that allows you to make changes to the term.

URI Editor opened on "Edit category" page

Further Customization Options

The plugin capabilities are significantly wider. You are free to adjust your permalinks in any way you see suitable. Furthermore, you may manually update any of the individual URL addresses if necessary.

You can also use whatever permalink base you choose. That is, you may have all links use the same permalink structure, as demonstrated below.

http://example.com/clothes/polos/ (Product category)
http://example.com/clothes/cotton-wool-blend/ (Product tag)
http://example.com/clothes/pique-polo/ (Product)

Remove "/product/" From URLs Without a Plugin

If you do not want to install a new plugin for something as simple as this, you can use a simple code snippet. You can implement this code in several ways:

  • Child Theme Integration:
    Add the code to your child theme's functions.php file.
  • Code Snippets Plugin:
    Use a plugin like Code Snippets for easier management
/**
* Remove "/product/" rewrite base from "product" permalinks
*
* @param string $post_link The post's permalink.
* @param WP_Post $post The post object.
* @param bool $leavename
* @param bool $sample
*
* @return string The modified post permalink.
*/
function pm_rewrite_product_permalinks( $post_link, $post, $leavename, $sample ) {
	 if ( ! empty( $post->post_type ) && in_array( $post->post_type, array( 'product' ) ) ) {
		 if ( $leavename ) {
			 $post_link = home_url( "%{$post->post_type}%" );
		 } else {
			 $post_link = home_url( $post->post_name );
		 }
		 $post_link = user_trailingslashit( $post_link );
	 }
	 return $post_link;
}
add_filter( 'post_type_link', 'pm_rewrite_product_permalinks', 10, 4 );
/**
* Modify the query to include "product" post type for pretty permalinks.
*
* @param WP_Query $query The current WP_Query object.
*/
function pm_parse_product_permalinks( $query ) {
	 if ( ! $query->is_main_query() || 2 != count( $query->query ) || ! isset( $query->query['page'] ) ) {
		 return;
	 }
	 if ( ! empty( $query->query['name'] ) ) {
		 $query->set( 'post_type', array( 'post', 'page', 'product' ) );
	 }
}
add_action( 'pre_get_posts', 'pm_parse_product_permalinks' );

Last updated by Maciej Bis on: February 23, 2025.


Maciej BisFounder of Permalink Manager & WordPress Developer

The developer behind Permalink Manager, a plugin for managing permalinks, has been working with WordPress, creating custom plugins and themes, for more than a decade.

Go up