Skip to content

Instantly share code, notes, and snippets.

  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save braddalton/5530851 to your computer and use it in GitHub Desktop.
add_action( 'pre_get_posts', 'remove_posts_in_category_on_blog' );
/**
* @author Brad Dalton - WP Sites
* @example http://wpsites.net/web-design/exclude-category-posts-page/
*/
function remove_posts_in_category_on_blog( $query ) {
global $wp_the_query;
if( $wp_the_query === $query && $query->is_home() ) {
$query->set( 'cat', '-007' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment