Custom Taxonomy Select Menu: Setting default option value?

Simply add an extra line before your for loop. For example:

function get_color_dropdown($taxonomies, $args){
    $myterms = get_terms($taxonomies, $args);
    $output ="<select onChange="window.location.href=this.value">";
    $output .= "<option value="default">Shop by Color --></option>";
    foreach($myterms as $term){
        $root_url = get_bloginfo('url');
        $term_taxonomy=$term->taxonomy;
        $term_slug=$term->slug;
        $term_name =$term->name;
        $link = $root_url."https://wordpress.stackexchange.com/".$term_taxonomy."https://wordpress.stackexchange.com/".$term_slug;
        $output .="<option value="".$link."">".$term_name."</option>";
    }
    $output .="</select>"; return $output;
}

$taxonomies = array('pa_color');
$args = array('orderby'=>'name','order'=>'ASC','hide_empty'=>true);
echo get_color_dropdown($taxonomies, $args);

You can always check to see if the return value is “default” to see if the select wasn’t set.

tech