Skip to content

Instantly share code, notes, and snippets.

Created Sep 28, 2015
Embed
What would you like to do?
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