Skip to content

Instantly share code, notes, and snippets.

@mwordpress
Created February 12, 2017 05:43
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 mwordpress/7d449e66c7d8150c10f15d287bfdbe96 to your computer and use it in GitHub Desktop.
Save mwordpress/7d449e66c7d8150c10f15d287bfdbe96 to your computer and use it in GitHub Desktop.
$query->set('cat', '-1,-2,-3,-4,-5');
if ( $query->is_archive ) {
if ( $query->is_home || $query->is_archive) {
function exclude_category($query) {
if ( $query->is_home ) {
$query->set("cat", "-xx");
}
return $query;
}
add_filter("pre_get_posts", "exclude_category");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment