From 90a3ab5f80ee943f8d8016f9ecae6a0f94ca10b7 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Wed, 8 Aug 2018 19:14:08 +0000 Subject: [PATCH] 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 --- src/wp-includes/taxonomy.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index 1806ad0fdb..8ec3eaee3e 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -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; }