我需要显示一个自定义帖子列表,但不包括任何具有自定义分类法51的帖子,是否可以使用下面的循环来实现?
$pages = get_children(array(\'orderby\' => \'post_date\', \'post_type\' => \'news\', \'numberposts\' => "3"));
$counter = 1;
foreach($pages as $post) {
setup_postdata($post);
$fields = get_fields();
}
更新时间:
自定义分类法称为opportunity,在自定义分类法中具有术语id 51。如果这有帮助的话,这就是我利用定制分类机会获取所有定制帖子的方式:
$pages = get_children(array(
\'orderby\' => \'post_date\',
\'post_type\' => \'news\',
\'post_status\' => \'future\',
\'numberposts\' => "3",
\'tax_query\' => array(
array(
\'taxonomy\' => \'news\',
\'field\' => \'id\',
\'terms\' => 51,
),
),));