How to include custom fields in wordpress search

This isn’t possible because your search term would not appear anywhere. You can search for the entire search term, but you can’t search for one part in the title/content and another part in the meta/fields, not without separate fields and separate values.

The only way this would work is if the title had the year in it, or the content had the year in it, or the meta contained the “fast five” part too, but if you want to search across all of it with part being in the meta and the other part being in title/content, then no, you can’t do that in stock vanilla WP. You would have to install 3rd party seach engine software such as OpenFlow/Algolia/Elastic Search that your host may not support.

WordPress search is very very primitive and not sophisticated. You should have very low expectations.


If you had asked how to search and also filter by year though, that would be much easier, e.g. if you had a search field with a dropdown for the year.

Searching for “Fast five” with a separate filter box of 2011 is a much easier problem to solve, allowing you to swap $query->query_vars['s'] in claika’s answer for a GET variable for your filter input/dropdown selector.