Display or retrieve the HTML dropdown list of categories.

The list of arguments is below: ‘show_option_all’ (string) – Text to display for showing all categories. ‘show_option_none’ (string) – Text to display for showing no categories. ‘option_none_value’ (mixed) – Value to use when no category is selected. ‘orderby’ (string) default is ‘ID’ – What column to use for ordering the categories. ‘order’ (string) default is ‘ASC’ – What direction to order categories. ‘show_count’ (bool|int) default is 0 – Whether to show how many posts are in the category. ‘hide_empty’ (bool|int) default is 1 – Whether to hide categories that don’t have any posts attached to them. ‘child_of’ (int) default is 0 – See {@link get_categories()}. ‘exclude’ (string) – See {@link get_categories()}. ‘echo’ (bool|int) default is 1 – Whether to display or retrieve content. ‘depth’ (int) – The max depth. ‘tab_index’ (int) – Tab index for select element. ‘name’ (string) – The name attribute value for select element. ‘id’ (string) – The ID attribute value for select element. Defaults to name if omitted. ‘class’ (string) – The class attribute value for select element. ‘selected’ (int) – Which category ID is selected. ‘taxonomy’ (string) – The name of the taxonomy to retrieve. Defaults to category.

The ‘hierarchical’ argument, which is disabled by default, will override the depth argument, unless it is true. When the argument is false, it will display all of the categories. When it is enabled it will use the value in the ‘depth’ argument.

Signature

wp_dropdown_categories( $args = '' )
args
 (string|array) Optional. Override default arguments.
Default: ''

Return

(string) HTML content only if 'echo' argument is 0.

Source

function wp_dropdown_categories( $args = '' ) {
	$defaults = array(
		'show_option_all' => '', 'show_option_none' => '',
		'orderby' => 'id', 'order' => 'ASC',
		'show_count' => 0,
		'hide_empty' => 1, 'child_of' => 0,
		'exclude' => '', 'echo' => 1,
		'selected' => 0, 'hierarchical' => 0,
		'name' => 'cat', 'id' => '',
		'class' => 'postform', 'depth' => 0,
		'tab_index' => 0, 'taxonomy' => 'category',
		'hide_if_empty' => false, 'option_none_value' => -1
	);

	$defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;

	// Back compat.
	if ( isset( $args['type'] ) && 'link' == $args['type'] ) {
		_deprecated_argument( __FUNCTION__, '3.0', '' );
		$args['taxonomy'] = 'link_category';
89 more lines...
WP Trac GitHub

Link here