Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

coderdj412 on "WP_Query empty when using tax_query"

$
0
0

I am attempting to query a couple taxonomies via a custom post type: venues.

Using the example, I came up with this query but, it comes up empty:

$args = array(
	'post_type' => 'venue',
	'tax_query' => array(
		array(
			'taxonomy' => 'venue_type',
			'field'    => 'slug',
			'terms'    => array('bar', 'club'),
		),
	),
);
$query = new WP_Query( $args );

But, if I use this, I get results:

$args = array(
	'venue_type'    => 'bar', // Will not accept arrays and I need multi
);
$query = new WP_Query( $args );

Viewing all articles
Browse latest Browse all 8245

Trending Articles