Im using this code to exclude a category but it still show all posts in exhibition.
$posts = get_posts(array(
'post_type' => 'exhibition',
'taxonomy' => 'categories_for_exhibitions',
'field' => 'slug',
'terms' => array('current'),
'operator' => 'NOT IN',
));
Im using this code to exclude a category but it still show all posts in exhibition.
$posts = get_posts(array(
'post_type' => 'exhibition',
'taxonomy' => 'categories_for_exhibitions',
'field' => 'slug',
'terms' => array('current'),
'operator' => 'NOT IN',
));
Share
Improve this question
edited Apr 23, 2020 at 21:29
Muhammad Adnan Bashir
asked Apr 23, 2020 at 19:05
Muhammad Adnan BashirMuhammad Adnan Bashir
93 bronze badges
1
- Welcome to WordPress Development. I hope you find the answer(s) you are looking for. Our site is different from most - if you have not done so yet, consider checking out the tour and help center to find out how things work. – Matthew Brown aka Lord Matt Commented Apr 23, 2020 at 19:52
1 Answer
Reset to default 0Found the answer so it can benefit someone else
$posts = get_posts(array(
'post_type' => 'exhibition',
'tax_query' => array(
array(
'taxonomy' => 'categories_for_exhibitions',
'field' => 'slug',
'terms' => 'current',
operator => 'NOT IN',
),
)
));
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744537753a4579532.html
评论列表(0条)