Skip to content

Instantly share code, notes, and snippets.

@vithalreddy
Created September 12, 2016 05:58
Show Gist options
  • Save vithalreddy/0683e3f8d57a73bc20803c2e1ed1d412 to your computer and use it in GitHub Desktop.
Save vithalreddy/0683e3f8d57a73bc20803c2e1ed1d412 to your computer and use it in GitHub Desktop.
function filterpagesinsearch($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts', 'filterpagesinsearch');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment