Skip to content

Instantly share code, notes, and snippets.

@donaldallen
Last active March 3, 2016 05:51
Show Gist options
  • Save donaldallen/0cad6e10730eddfc97a1 to your computer and use it in GitHub Desktop.
Save donaldallen/0cad6e10730eddfc97a1 to your computer and use it in GitHub Desktop.
<?php
add_filter('rewrite_rules_array', function ($rules) {
$new_rules = [];
$new_rules['^locations/(.+?)/(.+?)/(.+?)/?$'] = 'index.php?area=$matches[1]&area=$matches[2]&area=$matches[3]';
$new_rules['^locations/(.+?)/(.+?)/(.+?)/?$'] = 'index.php?area=$matches[1]&area=$matches[2]&locations=$matches[3]';
$new_rules['^locations/(.+?)/(.+?)/?$'] = 'index.php?area=$matches[1]&locations=$matches[2]';
$new_rules['^locations/(.+?)/(.+?)/?$'] = 'index.php?area=$matches[1]&area=$matches[2]';
$new_rules['^locations/(.+?)/?$'] = 'index.php?area=$matches[1]';
return $new_rules + $rules;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment