Taxonomy: Introduce new hooks when registering/unregistering taxonomies for object types.
Props soulseekah. Merges [43558] and [43631] to the 4.9 branch. Fixes #44733. Built from https://develop.svn.wordpress.org/branches/4.9@43632 git-svn-id: http://core.svn.wordpress.org/branches/4.9@43461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f18b19bac9
commit
3941885dc0
|
@ -578,6 +578,16 @@ function register_taxonomy_for_object_type( $taxonomy, $object_type) {
|
||||||
// Filter out empties.
|
// Filter out empties.
|
||||||
$wp_taxonomies[ $taxonomy ]->object_type = array_filter( $wp_taxonomies[ $taxonomy ]->object_type );
|
$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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,6 +616,17 @@ function unregister_taxonomy_for_object_type( $taxonomy, $object_type ) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] );
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9.9-alpha-43626';
|
$wp_version = '4.9.9-alpha-43632';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue