Hierarchical taxonomy dropdown wordpress

I have some custom taxonomies built in theme, and on the taxonomy dropdown, taxonomies are not showed in hierarchy. It just show a dropdown list of all taxonomies, but not in hierarchical order.

This is what I’ve got:

Read More
register_taxonomy(
        'recipesets',
        'recipe',
        array(
            'public'=>true,
            'hierarchical' => true,
            'labels'=> $labels,
            'query_var' => 'recipesets',
            'show_ui' => true,
            'rewrite' => array( 'slug' => 'recipesets', 'with_front' => false ),
        )
    );                    
} 

and calling:

<label for="edit-title" class="control-label"><i class="fa fa-folder-o"></i><?php _e('Category:', 'agrg') ?></label>
                        <select name="cat" id="cat" class="postform">
                            <?php

                            $terms = get_terms("recipesets", "orderby=count&hide_empty=0");
                            if ( !is_wp_error( $terms ) ) {
                                foreach ( $terms as $term ) {
                                   echo "<option value='" . $term->name . "'>" . $term->name . "</option>";

                                }
                            }

                            ?>
                        </select>

What to do?

Related posts

Leave a Reply