plugins wordpress

Search Exclude HTML Tags WordPress Plugin

One of my clients, Jonathan at FinePrint, emailed me last week about the search function of his WordPress-based site being broken. He noted that searching for the keyword “title” on his support forum was returning almost everything. After a few tests on his site and some others, I realized that the search for “title” was actually returning all posts with images because of the title attribute in the image tags. So the real issue was that the WordPress built-in search considers HTML tags in post content to be searchable content… and that this meant that all WordPress sites were similarly “broken”.

I ended up implementing a fix for FinePrint by employing a MySQL function fnStripTags (found all over the internet and attributed to Robert Davis) to strip the HTML tags, and telling WordPress to use it by hooking into the posts_search filter.

From what I’ve been able to find, this “bug” has been around for years so perhaps it’s simply not an issue that people really care about or they just consider it intended functionality. Although I’m actually surprised to find very little in the way of complaints… or maybe I haven’t looked hard enough. Anyway, since it makes a lot more sense to me that HTML tags be stripped, I’ve taken the time to bundle this fix up into a plugin and get it onto To apply on your site, just download, install, and activate!

Download the plugin “Search Exclude HTML Tags” from

Leave a Reply

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