• This code added to theme functions to output <span> around first word of title:

    add_filter('the_title', 'span_first_word');
    function span_first_word($title) {
    $words = explode(' ', $title);
    $words[0] = '<span>'.$words[0].'</span>';
    $title = implode(' ', $words);
    return $title;
    }

    It works great but is also putting the characters <span></span> in the titles list in the dashboard (but not in the title on the edit page). Is there a way to specify this change is only for the site and not the backend?

The topic ‘code added to theme functions.php is affecting dashboard’ is closed to new replies.