Although WordPress tends to strip out the all HTML tags in your post excerpts, sometimes, it is useful to highlight a word or phrase in your excerpts. Recently, I wanted to use some HTML tags in my excerpts for a specific project. I wanted to highlight a keyword or keyword phrase in the excerpt for SEO purposes.
Although my solution is more Genesis Framework oriented, you still can use the code to re-purpose for any WordPress projects.
All you have to do is use a code snippet in your functions.php file.Β As always, I’d like to advise to proceed only if you’re familiar with FTP client, e.g. FileZilla.
Here’s the code snippet you should add to your functions.php if your’e working on a theme running on Genesis Framework.
https://gist.github.com/topleague/3b862e6e7db149d607019703ff4d4d64
If it’s a non-Genesis WordPress site, add the following code to your functions.php file to allow HTML tags in your post excerpts.
https://gist.github.com/topleague/13d799f9f780bf4ca02046f7c87bbc03
That’s it – save your work and reload your page to test it.
Let me know if you have any questions.

