The permalinks are an essential part of your WooCommerce store's SEO performance. In this short article, you will find out whether or not this is a good idea to remove permalink bases from them.
Unfortunately, WordPress does not offer much freedom for customizing store URLs. This is because WordPress needs each custom post type or taxonomy, like "products" or "product categories" to have its unique permalink base to identify which content item to load.
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 is 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.
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.
Implementation Methods
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.
Using Permalink Manager Pro
Permalink Manager cab 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.
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.
You may now replace the permalink bases /product/, /product-category/, and /product-tag/ with any word you choose or delete them entirely.
Please remember to save the updated options by clicking the "Save Permastructures" button at the bottom of the page.
Remove WooCommerce Permalink Bases From Existing URLs
To make your existing products' URLs follow the new settings with the permalink bases removed, use the "Regenerate/reset" tool. After that, use the settings provided below:
- Mode:
Regenerate custom permalinks - Select content type:
Post types - Select post types:
Products - Select post statuses:
Published
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
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.
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.
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)
Code Snippet
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. - Custom Plugin:
Create and upload mini-plugin for extra code snippets. - 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' );