Title: wp_dropdown_cats
Published: April 25, 2014
Last modified: April 28, 2025

---

# wp_dropdown_cats( int $current_cat, int $current_parent, int $category_parent, int $level, array $categories ): void|false

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#wp--skip-link--target)

This function has been deprecated since 3.0.0. Use [wp_dropdown_categories()](https://developer.wordpress.org/reference/functions/wp_dropdown_categories/)
instead.

Legacy function used for generating a categories drop-down control.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#see-also)󠁿

 * [wp_dropdown_categories()](https://developer.wordpress.org/reference/functions/wp_dropdown_categories/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#parameters)󠁿

 `$current_cat`intoptional

ID of the current category. Default 0.

`$current_parent`intoptional

Current parent category ID. Default 0.

`$category_parent`intoptional

Parent ID to retrieve categories for. Default 0.

`$level`intoptional

Number of levels deep to display. Default 0.

`$categories`arrayoptional

Categories to include in the control. Default 0.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#return)󠁿

 void|false Void on success, false if no categories were found.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#source)󠁿

    ```php
    function wp_dropdown_cats( $current_cat = 0, $current_parent = 0, $category_parent = 0, $level = 0, $categories = 0 ) {
    	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_dropdown_categories()' );
    	if (!$categories )
    		$categories = get_categories( array('hide_empty' => 0) );

    	if ( $categories ) {
    		foreach ( $categories as $category ) {
    			if ( $current_cat != $category->term_id && $category_parent == $category->parent) {
    				$pad = str_repeat( '&#8211; ', $level );
    				$category->name = esc_html( $category->name );
    				echo "\n\t<option value='$category->term_id'";
    				if ( $current_parent == $category->term_id )
    					echo " selected='selected'";
    				echo ">$pad$category->name</option>";
    				wp_dropdown_cats( $current_cat, $current_parent, $category->term_id, $level +1, $categories );
    			}
    		}
    	} else {
    		return false;
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/deprecated.php#L137)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/deprecated.php#L137-L157)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_dropdown_cats()](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/)`wp-admin/includes/deprecated.php` |

Legacy function used for generating a categories drop-down control.

  | 
| [get_categories()](https://developer.wordpress.org/reference/functions/get_categories/)`wp-includes/category.php` |

Retrieves a list of category objects.

  | 
| [esc_html()](https://developer.wordpress.org/reference/functions/esc_html/)`wp-includes/formatting.php` |

Escaping for HTML blocks.

  | 
| [_deprecated_function()](https://developer.wordpress.org/reference/functions/_deprecated_function/)`wp-includes/functions.php` |

Marks a function as deprecated and inform when it has been used.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#)

| Used by | Description | 
| [wp_dropdown_cats()](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/)`wp-admin/includes/deprecated.php` |

Legacy function used for generating a categories drop-down control.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_dropdown_cats/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Deprecated. Use [wp_dropdown_categories()](https://developer.wordpress.org/reference/functions/wp_dropdown_categories/)  | 
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_dropdown_cats%2F)
before being able to contribute a note or feedback.