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
And I also want a code to not display featured on other query, is the code 'operator' => 'NOT IN' correct?
Thank you
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'
)),
);
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'
)),
);
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.