Better SEO automatically remove stop words from slug

Adding this snippet to the functions.php of your wordpress theme will automatically remove stop words from the slug for better SEO. This is an updated version of the (Better SEO)

 

 

add_filter('sanitize_title', 'remove_false_words');
function remove_false_words($slug) {
if (!is_admin()) return $slug;
$slug = explode('-', $slug);
foreach ($slug as $k => $word) {
//false words list separated for commas
$keys_false = 'a,about,above,across,after,again,against,all,almost,alone,along,already,also';
$keys = explode(',', $keys_false);
foreach ($keys as $l => $wordfalse) {
if ($word==$wordfalse) {
unset($slug[$k]);
}
}
}
return implode('-', $slug);
}

Leave a comment