Advertisements

is_object_in_taxonomy

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

Determine if the given object type is associated with the given taxonomy.

Parameters

  • string $object_type: Object type string
  • string $taxonomy: Single taxonomy name

Return values

returns:True if object is associated with the taxonomy, otherwise false.

Source code

function is_object_in_taxonomy($object_type, $taxonomy) {

	$taxonomies = get_object_taxonomies($object_type);



	if ( empty($taxonomies) )

		return false;



	if ( in_array($taxonomy, $taxonomies) )

		return true;



	return false;

}

2149

Advertisements

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: