This should work
function exclude_posts( $query ) {
if ( $query->is_home() ) {
$query->set( 'tag__not_in', array( 13 ) );
}
}
add_action( 'pre_get_posts', 'exclude_posts' );
tag
and tag_id
are not set up like cat
to accept negative numbers (ID numbers) for exclusion (conclusion based on experiments, not digging into the code (some other time, perhaps!)). Also, all of the examples in the Codex use is_home()
, is_admin()
, etc., but apparently is_home
does work – without the ()
.