|
/ Documentation /Developers Documentation/ Customize Product Category Rewrite Rules surerank_product_category_rewrite_rules

Customize Product Category Rewrite Rules surerank_product_category_rewrite_rules

Hook: surerank_product_category_rewrite_rules

Description: This filter allows developers to modify or add custom rewrite rules for product category archive URLs in SureRank. It is useful when you want to customize the permalink structure or support additional URL patterns for SEO or functional purposes.

Source: inc/frontend/archives.php

Usage: Use this filter to programmatically add or override rewrite rules for product categories.

Example:

PHP
// Modify the rewrite rules for the 'product_category' taxonomy in SureRank.
add_filter( 'surerank_product_category_rewrite_rules', 'custom_rules' );

function custom_rules( $rules ) {
    // Add your custom rewrite rules here
    $rules['product-category/custom-url/?$'] = 'index.php?product_category=custom-url';
    return $rules;
}

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
On this page
Scroll to Top