Skip to content

Instantly share code, notes, and snippets.

@banderon
Created January 25, 2013 20:58
Show Gist options
  • Save banderon/4637787 to your computer and use it in GitHub Desktop.
Save banderon/4637787 to your computer and use it in GitHub Desktop.
add_filter( 'pre_get_posts', function($query){
if ( !is_search() ){
return $query;
}
if ( ($post_type = $query->get('post_type')) ) {
$query->set('post_types', $post_type);
}
return $query;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment