Create dropdown HTML content of users.

The content can either be displayed, which it is by default or retrieved by setting the ‘echo’ argument. The ‘include’ and ‘exclude’ arguments do not need to be used; all users will be displayed in that case. Only one can be used, either ‘include’ or ‘exclude’, but not both.

The available arguments are as follows:

  1. show_option_all – Text to show all and whether HTML option exists.
  2. show_option_none – Text for show none and whether HTML option exists.
  3. hide_if_only_one_author – Don’t create the dropdown if there is only one user.
  4. orderby – SQL order by clause for what order the users appear. Default is ‘display_name’.
  5. order – Default is ‘ASC’. Can also be ‘DESC’.
  6. include – User IDs to include.
  7. exclude – User IDs to exclude.
  8. multi – Default is ‘false’. Whether to skip the ID attribute on the ‘select’ element. A ‘true’ value is overridden when id argument is set.
  9. show – Default is ‘display_name’. User table column to display. If the selected item is empty then the user_login will be displayed in parentheses
  10. echo – Default is ’1′. Whether to display or retrieve content.
  11. selected – Which User ID is selected.
  12. include_selected – Always include the selected user ID in the dropdown. Default is false.
  13. name – Default is ‘user’. Name attribute of select element.
  14. id – Default is the value of the ‘name’ parameter. ID attribute of select element.
  15. class – Class attribute of select element.
  16. blog_id – ID of blog (Multisite only). Defaults to ID of current blog.
  17. who – Which users to query. Currently only ‘authors’ is supported. Default is all users.

Signature

wp_dropdown_users( $args = '' )
args
 (string|array) Optional. Array of user arguments.
Default: ''

Return

(string|null) Null on display. String of HTML content on retrieve.

Source

function wp_dropdown_users( $args = '' ) {
	$defaults = array(
		'show_option_all' => '', 'show_option_none' => '', 'hide_if_only_one_author' => '',
		'orderby' => 'display_name', 'order' => 'ASC',
		'include' => '', 'exclude' => '', 'multi' => 0,
		'show' => 'display_name', 'echo' => 1,
		'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '',
		'blog_id' => $GLOBALS['blog_id'], 'who' => '', 'include_selected' => false
	);

	$defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0;

	$r = wp_parse_args( $args, $defaults );
	extract( $r, EXTR_SKIP );

	$query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) );
	$query_args['fields'] = array( 'ID', 'user_login', $show );
	$users = get_users( $query_args );

	$output = '';
51 more lines...
WP Trac GitHub

Link here