wp_dropdown_categories and custom attribute

The only filter available is wp_dropdown_cats, which allows you to filter the entire HTML select string and that means trying to string-match markup. That is always a bit questionable. Still…

function dropdown_data_attr_wpse_213033($output){
  return str_replace('<select','<select data-live-search="true"',$output);
}
add_filter('wp_dropdown_cats','dropdown_data_attr_wpse_213033');
wp_dropdown_categories(); // test