// Search Highlighting function buson_highlight_search_results($text) { if (is_search()) { $pattern = '/('. join('|', explode(' ', get_search_query())).')/i'; $text = preg_replace($pattern, '<span class="search-highlight">\0</span>', $text); } return $text; } add_filter('the_content', 'buson_highlight_search_results'); add_filter('the_excerpt', 'buson_highlight_search_results'); add_filter('the_title', 'buson_highlight_search_results');