Created
December 13, 2013 09:48
-
-
Save shemul49rmc/7942098 to your computer and use it in GitHub Desktop.
Remove Stop Words from URL
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
/** | |
* Remove Stop Words from URL By http://goo.gl/ht6fZo// | |
*/ | |
add_filter('sanitize_title', 'remove_stop_words'); | |
function remove_stop_words($slug) { | |
if (!is_admin()) return $slug; | |
$slug = explode('-', $slug); | |
foreach ($slug as $k => $word) { | |
// List of stop words comma separated | |
$keys_false = 'a,the,him,her,how'; | |
$keys = explode(',', $keys_false); | |
foreach ($keys as $l => $wordfalse) { | |
if ($word==$wordfalse) { | |
unset($slug[$k]); | |
} | |
} | |
} | |
return implode('-', $slug);} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment