如何仅获取父类别 ID。不是儿童类别 ID,我之前尝试过这段代码,它显示了所有类别的 ID
<?php $category_ids = get_all_category_ids();
foreach($category_ids as $cat_id) {
$cat_name = get_cat_name($cat_id);
//echo '<span class="png_bg category_icon"></span>' . $cat_name ;
?>
<option><?php echo '<span class="png_bg category_icon"></span>' . $cat_name ; ?></option>
<?php
}
?>
</select>