Skip to content

Tip: Automatically remove short words from the URL

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…

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) {
    return implode('-', $slug);

Credits to Kevin Chard

Leave a Reply

Your email address will not be published. Required fields are marked *