|
/ Documentation /Developers Documentation/ Remove Product Category Base surerank_remove_product_category_base

Remove Product Category Base surerank_remove_product_category_base

Hook: surerank_remove_product_category_base

Description: This filter allows you to remove the default /product-category/ base from WooCommerce product category URLs. For example, /product-category/shoes/ can become /shoes/. Shorter URLs do not guarantee a ranking benefit.

Source: inc/frontend/crawl-optimization.php

Use Case: Use this when shorter product category paths fit your site structure, after checking for conflicting URLs.

Usage: Remove the base from product category URLs when WooCommerce is active

Example:

PHP
// Enable the option to remove the 'product-category' base from product category URLs in SureRank
add_filter( 'surerank_remove_product_category_base', '__return_true' );

Note: Back up and test on staging first. After enabling the filter, visit Settings > Permalinks and save once to regenerate rewrite rules. Verify old and new category URLs, redirects, and unrelated routes for conflicts, and update internal links and sitemaps as appropriate.

You can add the example code to your child theme’s functions.php file or use a plugin like Code Snippets to safely insert custom code. Using a code snippet plugin is recommended for easier management and to ensure the code remains active even if you switch themes.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
Table of Contents
Scroll to Top