Taxonomy: Introduce new hooks when registering/unregistering taxonomies for object types.

Props soulseekah.
Fixes #44733.
Built from https://develop.svn.wordpress.org/trunk@43558


git-svn-id: http://core.svn.wordpress.org/trunk@43387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2018-08-08 19:15:27 +00:00
parent 071984839c
commit 297c7e4c8f
2 changed files with 22 additions and 1 deletions

View File

@ -613,6 +613,16 @@ function register_taxonomy_for_object_type( $taxonomy, $object_type ) {
// Filter out empties.
$wp_taxonomies[ $taxonomy ]->object_type = array_filter( $wp_taxonomies[ $taxonomy ]->object_type );
/**
* Fires after a taxonomy is registered for an object type.
*
* @since 5.0.0
*
* @param string $taxonomy Taxonomy name.
* @param string $object_type Name of the object type.
*/
do_action( 'registered_taxonomy_for_object_type', $taxonomy, $object_type );
return true;
}
@ -644,6 +654,17 @@ function unregister_taxonomy_for_object_type( $taxonomy, $object_type ) {
}
unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] );
/**
* Fires after a taxonomy is unregistered for an object type.
*
* @since 5.0.0
*
* @param string $taxonomy Taxonomy name.
* @param string $object_type Name of the object type.
*/
do_action( 'unregistered_taxonomy_for_object_type', $taxonomy, $object_type );
return true;
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-43556';
$wp_version = '5.0-alpha-43558';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.