I use custom fields for lots of my content on both Posts and Pages, so that half of the text will be in the main post body and the other half in a custom field.

Unfortunately, when doing this only the text in the post body is searchable.

I want to have all the custom fields included in the search (just joined together as one). Preferably without installing a plugin, as all the plugins I have seen do not seem to be able to do this or they add loads of options I don't need.

I just would like one search box, that uses WordPress's default search but finds words in custom fields as well as those in the main body.

Is this possible?

  • I can tell you that it's certainly possible, though I can't give you the specific code to make it happen. Hopefully someone else can chime in with more. I think you would hook in somewhere before the posts are selected, and check if it's a search. If so, filter posts_join and posts_where to join the post meta table and look for the search term in post meta.
    – Milo
    Commented May 31, 2011 at 18:02

2 Answers 2


You could use a plugin like "Search Everything" which lets you toggle what to include in the search (including Custom Fields). Check it out here: http://wordpress.org/extend/plugins/search-everything/

  • 1
    this plugin have some flaws! Like showing you not published entries. If you use attachment search, ti will show attachments of not published posts..and so on.
    – Tommixoft
    Commented May 20, 2012 at 9:50

In the end I used the Relevanssi plugin which lets you include custom fields in the search quite easily, you can either include all the fields or choose which fields to include.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.