Don’t use query_posts()
. Filter pre_get_posts
instead:
function wpse65927_filter_pre_get_posts( $query ) {
// If this is the blog posts index,
// and if this is the main query,
// exclude category 6
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'cat', '-6' );
}
}
add_action( 'pre_get_posts', 'wpse65927_filter_pre_get_posts' );
Put the above hook and callback in functions.php
. Don’t modify any of your template files, including index.php
or home.php
, at all.