Query loop taxonomies AND instead of OR?

When I use a query loop and filter posts by tags, how can I specify that I only want posts from tag 1 AND tag 2? So only posts that have BOTH tags.

It looks like if I list both tags, it’s showing all posts from either tag.

Hey Marcus, currently is not possible via UI. But I’ll be adding that feature in the future.

For now, this filter will help you:

In order for this to work, you need to add a custom class to your Grid block that is a child of the query loop block.

add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
	if (
		! empty( $attributes['className'] ) &&
		strpos( $attributes['className'], 'my-grid-custom-class' ) !== false
	) {
		$query_args['tax_query'][0]['operator'] = 'AND';

	return $query_args;
}, 10, 2 );

Awesome, thanks! When you do add to the UI, it might also be helpful to allow a combination of operators. For example, show all posts from cat1 OR cat2 with tag1 AND tag2.

Yes, it will be per the taxonomy you added. In the current version, is already possible to have multiple taxonomies filters.