Apologies for the lack of code, but I have no idea where to start with this - is it possible to extend Wordpress's search function to include excerpts and (custom) taxonomies as well as the standard title and post content in search results? i.e. search results don't include posts that contain keywords found in excerpts or taxonomies, is it possible to include them?

Ideally, I'd like to do this without a plugin if possible, is there a way to extend it via functions.php?

Thanks for any pointers.


  • There is no really easy way to do this, you will have to use a plugin or create your own search code.
    – Wyck
    Aug 16, 2013 at 4:17
  • @Wick - thanks for getting back to me, I assume the 'Search Everything' plugin is going to be the easiest solution then?
    – Osu
    Aug 16, 2013 at 8:14

1 Answer 1


With Wordpress 4.2.2 I'm using the following (admittedly fragile) method to search excerpts as well as the content and title without a plugin.

This is the relevant snippet from functions.php.

add_filter('posts_where', 'custom_posts_where');

function custom_posts_where($where) {
    if (is_search()) {
        $where = preg_replace(
            "/(\w+).post_title LIKE ('%.*?%')/",
            "$1.post_title LIKE $2) OR ($1.post_excerpt LIKE $2",

return $where;
  • This is a good start but seems fragile like you said. It would be great if wordpress would provide some core hooks to add and prioritize different search fields and logic in general.
    – Richrd
    Jun 20, 2018 at 23:46

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.