‪Another little tweak to my website; the posts of type‬ 'status', which I use most of the time as a source for syndication to twitter (as with this post here right now), are now excluded from the main 'category' archives. The "pre_get_posts" hook is handy for this:

This hook is called after the query variable object is created, but before the actual query is run.

So it is a way to tweak the query that WordPress is normally using. In my case, I want to exclude all post with the post-format "status", when the query is the archive query ("show all posts of category/tag/type")… but not if it is the archive of the post-type "status".

function wbr_exclude_post_formats_from_archive( $query ) {
	if( $query->is_main_query() && $query->is_archive() && ! is_tax('post_format','post-format-status') ) {
		$tax_query = array( array(
			'taxonomy' => 'post_format',
			'field' => 'slug',
			'terms' => array( 'post-format-status'),
			'operator' => 'NOT IN',
		) );
		$query->set( 'tax_query', $tax_query );
	}
}
add_action( 'pre_get_posts', 'wbr_exclude_post_formats_from_archive' );

It took a little while to find the right function for the last condition, but now with "is_tax" it works pretty good.