Created
May 17, 2016 17:44
-
-
Save WPDevHQ/e735b3034f5ea8fc41ce700e1065d657 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'rewrite_rules_array', function( $rules ) { | |
$new_rules = array( | |
'shop/([^/]*?)/page/([0-9]{1,})/?$' => 'index.php?product_cat=$matches[1]&paged=$matches[2]', | |
'shop/([^/]*?)/?$' => 'index.php?product_cat=$matches[1]', | |
); | |
return $new_rules + $rules; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the above rewrite rules to either the child theme's functions.php or better still, use a site functions plugin.