我正在使用下面的代码,但只显示父类别,而我有许多子类别。我想显示所有类别,包括家长和孩子
<label for="<?php echo $this->get_field_id( \'link\' ); ?>"><?php _e( \'دسته بندی\' ); ?></label>
<select id="<?php echo $this->get_field_id(\'link\'); ?>" name="<?php echo $this->get_field_name(\'link\'); ?>" class="widefat" style="width:100%;">
<?php foreach(get_terms(\'category\',\'parent=0&hide_empty=false\') as $term) { ?>
<option <?php selected( $instance[\'link\'], $term->term_id ); ?> value="<?php echo $term->term_id; ?>"><?php echo $term->name; ?></option>
<?php } ?>
</select>