From 5c0ddb860239cdc0c6004429c83756d2c786815f Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Sun, 11 Jan 2015 01:26:27 +0000 Subject: [PATCH] Default `$parent` in `category_exists()` should default to null rather than 0. [29863] made the corresponding change in `term_exists()`. Failure to change the default value in `category_exists()` meant that an unspecified value for `$parent` would limit results to top-level categories. Includes unit tests and corrected function documentation. Props hissy. Fixes #30975 for trunk. Built from https://develop.svn.wordpress.org/trunk@31140 git-svn-id: http://core.svn.wordpress.org/trunk@31121 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/taxonomy.php | 11 +++++++---- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/taxonomy.php b/wp-admin/includes/taxonomy.php index 124c0239a3..52cff7f23c 100644 --- a/wp-admin/includes/taxonomy.php +++ b/wp-admin/includes/taxonomy.php @@ -11,14 +11,17 @@ // /** - * {@internal Missing Short Description}} + * Check whether a category exists. * * @since 2.0.0 * - * @param int|string $cat_name - * @return int + * @see term_exists() + * + * @param int|string $cat_name Category name. + * @param int $parent Optional. ID of parent term. + * @return mixed */ -function category_exists($cat_name, $parent = 0) { +function category_exists( $cat_name, $parent = null ) { $id = term_exists($cat_name, 'category', $parent); if ( is_array($id) ) $id = $id['term_id']; diff --git a/wp-includes/version.php b/wp-includes/version.php index 8fd368fbaf..9c8495317f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31139'; +$wp_version = '4.2-alpha-31140'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.