You’re setting arguments for the main query in your pre_get_posts
action, and then overwriting that query in the template by calling query_posts
(which you should never use).
If you want to exclude categories, do that in the same pre_get_posts
action:
add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
function add_my_post_types_to_query( $query ) {
if ( is_home() && $query->is_main_query() ){
$query->set( 'post_type', array( 'post', 'miss_behave', 'emily_davies','gemma_patel','poppy_smythe' ) );
$query->set( 'category__not_in', array(4, 142, 143, 144) );
}
}
EDIT- using the arguments in an additional query:
$the_query = new WP_Query(
array(
'post_type' => array( 'post', 'miss_behave', 'emily_davies','gemma_patel','poppy_smythe' ),
'category__not_in' => array(4, 142, 143, 144)
)
);