$output .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $category->{$value_field} ) . "\"";
- if ( $category->{$value_field} == $args['selected'] )
+ // Type-juggling causes false matches, so we force everything to a string.
+ if ( (string) $category->{$value_field} === (string) $args['selected'] )
$output .= ' selected="selected"';
$output .= '>';
$output .= $pad.$cat_name;