mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-03 20:24:26 +00:00
wp_dropdown_pages() allows option_none_value to be passed. Add that arg to the $defaults for wp_dropdown_users() and wp_dropdown_categories() as well.
Props solarissmoke. Fixes #16625. git-svn-id: https://develop.svn.wordpress.org/trunk@28564 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1285,7 +1285,8 @@ function wp_dropdown_users( $args = '' ) {
|
||||
'include' => '', 'exclude' => '', 'multi' => 0,
|
||||
'show' => 'display_name', 'echo' => 1,
|
||||
'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '',
|
||||
'blog_id' => $GLOBALS['blog_id'], 'who' => '', 'include_selected' => false
|
||||
'blog_id' => $GLOBALS['blog_id'], 'who' => '', 'include_selected' => false,
|
||||
'option_none_value' => -1
|
||||
);
|
||||
|
||||
$defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0;
|
||||
@@ -1294,6 +1295,7 @@ function wp_dropdown_users( $args = '' ) {
|
||||
$show = $r['show'];
|
||||
$show_option_all = $r['show_option_all'];
|
||||
$show_option_none = $r['show_option_none'];
|
||||
$option_none_value = $r['option_none_value'];
|
||||
|
||||
$query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) );
|
||||
$query_args['fields'] = array( 'ID', 'user_login', $show );
|
||||
@@ -1314,8 +1316,8 @@ function wp_dropdown_users( $args = '' ) {
|
||||
}
|
||||
|
||||
if ( $show_option_none ) {
|
||||
$_selected = selected( -1, $r['selected'], false );
|
||||
$output .= "\t<option value='-1'$_selected>$show_option_none</option>\n";
|
||||
$_selected = selected( $option_none_value, $r['selected'], false );
|
||||
$output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$_selected>$show_option_none</option>\n";
|
||||
}
|
||||
|
||||
$found_selected = false;
|
||||
|
||||
Reference in New Issue
Block a user