WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/registered taxonomy

Description

registered_taxonomy is a hook triggered after a custom taxonomy has been registered. This hook provides the taxonomy key, the name of the object type for the taxonomy object and arguments used to register the taxonomy as parameters.

Usage

<?php add_action( 'registered_taxonomy', 'function_name' ); ?>

where "function_name" is the name of the function to be called.

Parameters

$taxonomy
(string) (optional) The key for the custom taxonomy that is being registered.
Default: None
$object_type
(array/string) (required) Name of the object type for the taxonomy registered.
Default: None
$args
(array/string) (optional) Array of arguments used to register the custom taxonomy as described in register_taxonomy().
Default: None

Example

/**
 * Example of registered_taxonomy usage
 * @param string $taxonomy Taxonomy key.
 * @param array|string $object_type Name of the object type for the taxonomy object.
 * @param array|string $args Optional args used in taxonomy registration.
 */
function wporg_registered_taxonomy_example( $taxonomy, $object_type, $args ) {
	if ( 'customtax' == $taxonomy ) {
		// Do something after customtax is registered as custom taxonomy
	}
}
add_action( 'registered_taxonomy', 'wporg_registered_taxonomy_example', 10, 3 );

Source File

The registered_taxonomy hook is found in wp-includes/taxonomy.php within the register_taxonomy() function.