我正在尝试删除帖子为零的术语/分类法。下面是代码,它抛出错误警告:为第二个 foreach() 提供的参数无效。有什么建议么?
$terms = get_terms( array(
'taxonomy' => 'post-type',
'hide_empty' => false,
));
$q = new WP_Query($terms);
foreach($q as $term){
foreach($term as $t) {
if($t->count == 0)
wp_delete_term( $t->term_id, 'post-type');
}
}`