Exclude category on blog list page

From a plugin or your theme’s functions.php file:

function wpse106861_mod_query( $query ) {
    /* are we on the blog page ? */
    if ( $query->is_home() && $query->is_main_query() ) {
        /* get ID of news category */
        $news_id = get_cat_ID( 'news' );
        /* exclude posts in new from query */
        $query->set( 'category__not_in' => array( $news_id ) );
    }
}
add_action( 'pre_get_posts', 'wpse106861_mod_query' );

Update
As for the comment:
is_home should return true on any blog index page, regardless of whether that’s a static page or your front page. You can check for the front page directly as well anyhow, by slightly altering the conditional:

if ( $query->is_front_page() && $query->is_main_query() )

Related Reading

Leave a Comment