Commit ec15921c78 for wordpress.org
commit ec15921c7873eb5f23cc88722ea21dae0de98b47
Author: Weston Ruter <weston@xwp.co>
Date: Tue Nov 25 01:34:30 2025 +0000
Docs: Update typing for `wp_create_category()`.
* Ensure that `wp_create_category()` returns `int` as opposed to `numeric-string`.
* Rename `$cat_name` to `$category_name` to avoid abbreviating variables.
* Update docblock to remove erroneous `int` for `$category_name` param when only `string` is intended.
* Add missing tests for `wp_create_category()`.
Developed in https://github.com/WordPress/wordpress-develop/pull/8861
Props justlevine, westonruter.
See #64238, #64226.
Built from https://develop.svn.wordpress.org/trunk@61298
git-svn-id: http://core.svn.wordpress.org/trunk@60610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/taxonomy.php b/wp-admin/includes/taxonomy.php
index 359cfafe2f..470d36d55f 100644
--- a/wp-admin/includes/taxonomy.php
+++ b/wp-admin/includes/taxonomy.php
@@ -48,19 +48,19 @@ function get_category_to_edit( $id ) {
*
* @since 2.0.0
*
- * @param int|string $cat_name Category name.
- * @param int $category_parent Optional. ID of parent category.
- * @return int|WP_Error
+ * @param string $category_name Category name.
+ * @param int $category_parent Optional. ID of parent category.
+ * @return int The ID of category term on success, or zero on failure.
*/
-function wp_create_category( $cat_name, $category_parent = 0 ) {
- $id = category_exists( $cat_name, $category_parent );
+function wp_create_category( $category_name, $category_parent = 0 ) {
+ $id = category_exists( $category_name, $category_parent );
if ( $id ) {
- return $id;
+ return (int) $id;
}
return wp_insert_category(
array(
- 'cat_name' => $cat_name,
+ 'cat_name' => $category_name,
'category_parent' => $category_parent,
)
);
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 1ae1d9a901..cc15b43048 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61295';
+$wp_version = '7.0-alpha-61298';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.