admin管理员组文章数量:1384639
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',
),
)
));
本文标签: theme developmentExclude categories from wp query not working
版权声明:本文标题:theme development - Exclude categories from wp query not working 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744537752a2611418.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论