WordPress: Highlight Search Terms Without Plugin

1. Add below 3 functions to your functions.php

For height light the search terms in post excerpt

For height light the search terms in post title

For height light the search terms in post content

2. After that, in your loop or search.php file call

instead of

3. In your css add the search-highlight class which will highlight all searched words in yellow.

Leave a Reply

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

CAPTCHA