Link to home
Start Free TrialLog in
Avatar of Pham Trung Kien
Pham Trung Kien

asked on

Get posts in custom taxonomy category?

Hi,

I want to get posts in custom taxonomy category, I have code below but it show nothing, could you please check it for me? I want to get post with slug events in wg_category

$args=array(
	'post_type' => wg_get_deal_post_type(),
	'post_status' => 'publish',
	'paged' => $paged,
	'tax_query'	=> array(
		array(
			'taxonomy'  => 'wg_category',
			'field'     => 'slug',
			'terms'     => 'events',
			),
		),
	'meta_query' => array(
		array(
			'key' => '_expiration_date',
			'value' => array(0, current_time('timestamp')),
			'compare' => 'BETWEEN'
		)),
);

Open in new window


And I also want a code to not display featured on other query, is the code 'operator'  => 'NOT IN' correct?
$args=array(
	'post_type' => wg_get_deal_post_type(),
	'post_status' => 'publish',
	'paged' => $paged,
	'tax_query'	=> array(
		array(
			'taxonomy'  => 'wg_category',
			'field'     => 'slug',
			'terms'     => 'featured',
			'operator'  => 'NOT IN'
			),
		),
	'meta_query' => array(
		array(
			'key' => '_expiration_date',
			'value' => array(0, current_time('timestamp')),
			'compare' => 'BETWEEN'
		)),
);

Open in new window


Thank you
ASKER CERTIFIED SOLUTION
Avatar of eemit
eemit
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial