Created
June 27, 2017 14:54
-
-
Save djrmom/f38a626cfb6fdc51e6b0c4e07c1e347a to your computer and use it in GitHub Desktop.
wordpress rewrites
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
<?php | |
/** | |
* remove search rules so that we can use /search/slug/ as a page | |
* | |
* @param $rules | |
* | |
* @return mixed | |
*/ | |
function prefix_links_remove_search($rules){ | |
foreach ($rules as $rule => $rewrite) { | |
if ( preg_match('/^search/',$rule) ) { | |
unset($rules[$rule]); | |
} | |
} | |
return $rules; | |
} | |
add_filter('rewrite_rules_array', 'prefix_links_remove_search'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment