Skip to content

Instantly share code, notes, and snippets.

Created September 28, 2015 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/cd0d7d8d3bc49ec88f04 to your computer and use it in GitHub Desktop.
Save anonymous/cd0d7d8d3bc49ec88f04 to your computer and use it in GitHub Desktop.
function search_filter($query) {
if(!is_admin()) {
if($query->is_main_query() || is_archive()) {
$query->set('post_type', 'post');
$query->set('cat', '-1307,-1');
}
}
}
return $query;
}
add_action('pre_get_posts', 'search_filter');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment