Display Taxonomy Term Children in a Drop Down without Submit Button

This actually quite an interesting question. I did this answer last night that gets a list of all taxonomies with a list of the terms belonging to that specific taxonomy. The code in there can very easily be adapted to what to want to do.

I also went and though of other methods and got googling for ideas and I came up with this idea from frankiejarrett.com. Why not create your own dropdown function like wp_dropdown_categories, which makes sense to me

Here is what Frankie explained

Method #2

That’s where Method #2 comes in. We’ll have to write our own custom function that will generate the dropdown so we can output each option value as a slug:

Here is the function for the custom dropdown function to list your terms

function fjarrett_custom_taxonomy_dropdown( $taxonomy ) {
    $terms = get_terms( $taxonomy );
    if ( $terms ) {
        printf( '<select name="%s" class="postform">', esc_attr( $taxonomy ) );
        foreach ( $terms as $term ) {
            printf( '<option value="%s">%s</option>', esc_attr( $term->slug ), esc_html( $term->name ) );
        }
        print( '</select>' );
    }
}

This can now be called in your template like

<?php fjarrett_custom_taxonomy_dropdown( 'my_custom_taxonomy' ); ?>

He further went and did a more comprehensive function

Expansions on Method #2

If you’re a coding rockstar you can take Method #2 even further by making room for more parameters. This will give you even more control and make it function more like wp_dropdown_categories does:

function fjarrett_custom_taxonomy_dropdown( $taxonomy, $orderby = 'date', $order="DESC", $limit="-1", $name, $show_option_all = null, $show_option_none = null ) {
    $args = array(
        'orderby' => $orderby,
        'order' => $order,
        'number' => $limit,
    );
    $terms = get_terms( $taxonomy, $args );
    $name = ( $name ) ? $name : $taxonomy;
    if ( $terms ) {
        printf( '<select name="%s" class="postform">', esc_attr( $name ) );
        if ( $show_option_all ) {
            printf( '<option value="0">%s</option>', esc_html( $show_option_all ) );
        }
        if ( $show_option_none ) {
            printf( '<option value="-1">%s</option>', esc_html( $show_option_none ) );
        }
        foreach ( $terms as $term ) {
            printf( '<option value="%s">%s</option>', esc_attr( $term->slug ), esc_html( $term->name ) );
        }
        print( '</select>' );
    }
}

which you can call in your template as

<?php fjarrett_custom_taxonomy_dropdown( 'my_custom_taxonomy', 'date', 'DESC', '5', 'my_custom_taxonomy', 'Select All', 'Select None' ); ?>

I hope all of this helps to reach your goal

EDIT

To get the children of a term, you should use get_term_children. I’ve modified the code in the example to make it work in a dropdown

<form action="<?php bloginfo('url'); ?>/" method="get">

<?php
$term_id = 118;
$taxonomy_name="event_cat";
$termchildren = get_term_children( $term_id, $taxonomy_name );

echo '<select name="' . $taxonomy_name . '" onchange="this.form.submit()">';
echo '<option selected>All terms in ' . $taxonomy_name . '</option>';
foreach ( $termchildren as $child ) {
    $term = get_term_by( 'id', $child, $taxonomy_name );
    $link = get_term_link( $term, $taxonomy_name );
    echo '<option value="'.$term->slug.'"><a href="' .esc_url( $link ) . '">' . $term->name . '</a></option>';
}
echo '</select>';
?> 
<noscript><div><input type="submit" value="View" /></div></noscript>

</form>