Taxonomy: In `register_taxonomy()`, return the registered taxonomy object on success, for consistency with `register_post_type()`.

Props krynes, SergeyBiryukov.
Fixes #48558.
Built from https://develop.svn.wordpress.org/trunk@47186


git-svn-id: http://core.svn.wordpress.org/trunk@46986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-05 06:26:06 +00:00
parent b3f75c66f4
commit 4f422b028d
2 changed files with 4 additions and 2 deletions

View File

@ -408,7 +408,7 @@ function is_taxonomy_hierarchical( $taxonomy ) {
* @type bool $_builtin This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY! * @type bool $_builtin This taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY!
* Default false. * Default false.
* } * }
* @return void|WP_Error Void on success, WP_Error object on failure. * @return WP_Taxonomy|WP_Error The registered taxonomy object on success, WP_Error object on failure.
*/ */
function register_taxonomy( $taxonomy, $object_type, $args = array() ) { function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
global $wp_taxonomies; global $wp_taxonomies;
@ -441,6 +441,8 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
* @param array $args Array of taxonomy registration arguments. * @param array $args Array of taxonomy registration arguments.
*/ */
do_action( 'registered_taxonomy', $taxonomy, $object_type, (array) $taxonomy_object ); do_action( 'registered_taxonomy', $taxonomy, $object_type, (array) $taxonomy_object );
return $taxonomy_object;
} }
/** /**

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-alpha-47185'; $wp_version = '5.4-alpha-47186';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.