Skip to content

Commit

Permalink
Taxonomy: Introduce new hooks when registering/unregistering taxonomi…
Browse files Browse the repository at this point in the history
…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 authored and nylen committed Dec 16, 2018
1 parent 5923e83 commit 40e6a29
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/wp-includes/taxonomy.php
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 40e6a29

Please sign in to comment.