Taxonomy: Introduce new hooks when registering/unregistering taxonomies for object types.
Props soulseekah. Fixes #44733. git-svn-id: https://develop.svn.wordpress.org/trunk@43558 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c52e7c79b2
commit
90a3ab5f80
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user