Better SEO automatically remove short words from URL
wordpress snippet
Adding this snippet to the functions.php of your wordpress theme will automatically remove short words from the URL. This will remove words no larger then three characters long eg: in, and, but, is, etc…
I added an updated version of this snippet that uses stop words from a customizable list. This works better for most situations rather then arbitrarily removing words with three letters or less. Enjoy! ( example screenshot )snippet : PHPcopy
add_filter('sanitize_title', 'remove_short_words');
function remove_short_words($slug) {
if (!is_admin()) return $slug;
$slug = explode('-', $slug);
foreach ($slug as $k => $word) {
if (strlen($word) < 3) {
unset($slug[$k]);
}
}
return implode('-', $slug);
}
this months featured snippets
- http://www.facebook.com/teju79 Teo Jurina
- http://wpsnipp.com Kevin Chard
- David
- http://wpsnipp.com Kevin Chard
- Trieu Quang Khanh
- http://wpsnipp.com Kevin Chard
- Trieuquangkhanh
- http://twitter.com/amcajaty Alexandre M. Cajaty
- http://wpsnipp.com Kevin Chard
- http://www.houstonfirealarm.net/other_services.php Peerland Fire Alarm
- http://wpsnipp.com Kevin Chard
- http://wpsnipp.com Kevin Chard






