2

My wordpress site doesnt search for pages' content. I have checked for the existence of the following filter that could prevent search from searching pages but there aint any

add_filter('pre_get_posts','myfunction'); 

What else could I check for? Any help would be appreciated.

Regards, Loveleen

2

Try this:

function filter_search($query) {
    if ($query->is_search) {
    $query->set('post_type', array('post', 'page'));
    };
    return $query;
};
add_filter('pre_get_posts', 'filter_search');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy