register_taxonomy_for_object_type

Definition:
function register_taxonomy_for_object_type( $taxonomy, $object_type) {}

Add an already registered taxonomy to an object type.

Parameters

  • string $taxonomy: Name of taxonomy object
  • array|string $object_type: Name of the object type

Return values

returns:True if successful, false if not

Source code

function register_taxonomy_for_object_type( $taxonomy, $object_type) {

	global $wp_taxonomies;



	if ( !isset($wp_taxonomies[$taxonomy]) )

		return false;



	if ( ! get_post_type_object($object_type) )

		return false;



	if ( ! in_array( $object_type, $wp_taxonomies[$taxonomy]->object_type ) )

		$wp_taxonomies[$taxonomy]->object_type[] = $object_type;



	return true;

}

2687

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: