This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use a datalist in place of a select dropdown for wp_dropdown_users | |
add_filter('wp_dropdown_users', 'wp_dropdown_users_datalist'); | |
function wp_dropdown_users_datalist($html) { | |
preg_match("/name='(.*?)'/", $html, $name); | |
preg_match("/id='(.*?)'/", $html, $id); | |
$html = str_replace(array('<select', '/select>'), array('<datalist', '/datalist>'), $html); | |
$html = preg_replace("/id='$id[1]'/", "id='$id[1]-list'", $html); | |
$html = preg_replace("/name='$name[1]'/", '', $html); |