Created
January 29, 2018 23:29
-
-
Save alimoshen/3c7cb9aa1b41a7a94bb22768cca597fb to your computer and use it in GitHub Desktop.
Custom Rewrite rules
This file contains hidden or 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
add_filter('rewrite_rules_array', 'mmp_rewrite_rules'); | |
function mmp_rewrite_rules($rules) { | |
$newRules = array(); | |
$newRules['expertise/(.+)/(.+)/(.+)/(.+)/(.+)/?$'] = 'index.php?expertise=$matches[5]'; // use the 5th tax segment | |
$newRules['expertise/(.+)/(.+)/(.+)/(.+)/?$'] = 'index.php?expertise=$matches[4]'; // use the 4th tax segment | |
$newRules['expertise/(.+)/(.+)/(.+)/?$'] = 'index.php?expertise=$matches[3]'; // use the 3rd tax segment | |
$newRules['expertise/(.+)/(.+)/?$'] = 'index.php?expertise=$matches[2]'; // use the 2nd tax segment | |
$newRules['expertise/(.+)/(.+)/?$'] = 'index.php?expertise_type=$matches[2]'; | |
$newRules['expertise/(.+)/?$'] = 'index.php?expertise_type=$matches[1]'; | |
return array_merge($newRules, $rules); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment