Skip to content
Permalink
Browse files

Taxonomy: Introduce new hooks when registering/unregistering taxonomi…

…es for object types.

Props soulseekah.
Merges [43558] and [43631] to the 4.9 branch.
Fixes #44733.

git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43632 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
SergeyBiryukov committed Sep 6, 2018
1 parent 4c6175e commit bf71d6715996f912e992a629e44b8e6d3213a109
Showing with 21 additions and 0 deletions.
  1. +21 −0 src/wp-includes/taxonomy.php
@@ -578,6 +578,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 4.9.9
*
* @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;
}
@@ -606,6 +616,17 @@ function unregister_taxonomy_for_object_type( $taxonomy, $object_type ) {
return false;
unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] );
/**
* Fires after a taxonomy is unregistered for an object type.
*
* @since 4.9.9
*
* @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;
}

0 comments on commit bf71d67

Please sign in to comment.
You can’t perform that action at this time.