Skip to content

Instantly share code, notes, and snippets.

@Shininglow
Created August 15, 2017 06:30
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 Shininglow/18ece26970ef8caea205a5705887fc7d to your computer and use it in GitHub Desktop.
Save Shininglow/18ece26970ef8caea205a5705887fc7d to your computer and use it in GitHub Desktop.
function exclude_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'cat', '-1' );
}
}
add_action( 'pre_get_posts', 'exclude_category' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment