diff -r be944660c56a -r 3d72ae0968f4 wp/wp-admin/includes/taxonomy.php --- a/wp/wp-admin/includes/taxonomy.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-admin/includes/taxonomy.php Tue Sep 27 16:37:53 2022 +0200 @@ -17,12 +17,12 @@ * * @see term_exists() * - * @param int|string $cat_name Category name. - * @param int $parent Optional. ID of parent term. - * @return mixed + * @param int|string $cat_name Category name. + * @param int $category_parent Optional. ID of parent category. + * @return string|null Returns the category ID as a numeric string if the pairing exists, null if not. */ -function category_exists( $cat_name, $parent = null ) { - $id = term_exists( $cat_name, 'category', $parent ); +function category_exists( $cat_name, $category_parent = null ) { + $id = term_exists( $cat_name, 'category', $category_parent ); if ( is_array( $id ) ) { $id = $id['term_id']; } @@ -48,12 +48,12 @@ * * @since 2.0.0 * - * @param int|string $cat_name - * @param int $parent + * @param int|string $cat_name Category name. + * @param int $category_parent Optional. ID of parent category. * @return int|WP_Error */ -function wp_create_category( $cat_name, $parent = 0 ) { - $id = category_exists( $cat_name, $parent ); +function wp_create_category( $cat_name, $category_parent = 0 ) { + $id = category_exists( $cat_name, $category_parent ); if ( $id ) { return $id; } @@ -61,7 +61,7 @@ return wp_insert_category( array( 'cat_name' => $cat_name, - 'category_parent' => $parent, + 'category_parent' => $category_parent, ) ); } @@ -115,8 +115,8 @@ * @type int|string $category_parent Category parent ID. Default empty. * } * @param bool $wp_error Optional. Default false. - * @return int|object The ID number of the new or updated Category on success. Zero or a WP_Error on failure, - * depending on param $wp_error. + * @return int|WP_Error The ID number of the new or updated Category on success. Zero or a WP_Error on failure, + * depending on param `$wp_error`. */ function wp_insert_category( $catarr, $wp_error = false ) { $cat_defaults = array( @@ -215,7 +215,9 @@ * @since 2.3.0 * * @param int|string $tag_name - * @return mixed + * @return mixed Returns null if the term does not exist. + * Returns an array of the term ID and the term taxonomy ID if the pairing exists. + * Returns 0 if term ID 0 is passed to the function. */ function tag_exists( $tag_name ) { return term_exists( $tag_name, 'post_tag' );