From 63755028e8340445ed6062eeba4fa82e3087e433 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 19 May 2016 02:38:33 +0000 Subject: [PATCH] Introduce `required` argument for `wp_dropdown_categories()`. This allows the HTML5 `required` attribute to be added to the `select` element. Props wzislam, pcarvalho. Fixes #31909. git-svn-id: https://develop.svn.wordpress.org/trunk@37465 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/category-template.php | 7 +- .../tests/category/wpDropdownCategories.php | 68 +++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php index fbf9b9326e..232f147f96 100644 --- a/src/wp-includes/category-template.php +++ b/src/wp-includes/category-template.php @@ -314,6 +314,7 @@ function category_description( $category = 0 ) { * * @since 2.1.0 * @since 4.2.0 Introduced the `value_field` argument. + * @since 4.6.0 Introduced the `required` argument. * * @param string|array $args { * Optional. Array or string of arguments to generate a categories drop-down element. @@ -351,6 +352,8 @@ function category_description( $category = 0 ) { * @type string|array $taxonomy Name of the category or categories to retrieve. Default 'category'. * @type bool $hide_if_empty True to skip generating markup if no categories are found. * Default false (create select element even if no categories are found). + * @type bool $required Whether the \n"; + $output = "