is_object_in_taxonomy( string $object_type, string $taxonomy )

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


Parameters Parameters

$object_type

(string) (Required) Object type string.

$taxonomy

(string) (Required) Single taxonomy name.


Top ↑

Return Return

(bool) True if object is associated with the taxonomy, otherwise false.


Top ↑

Source Source

File: wp-includes/taxonomy.php

function is_object_in_taxonomy( $object_type, $taxonomy ) {
	$taxonomies = get_object_taxonomies( $object_type );
	if ( empty( $taxonomies ) ) {
		return false;
	}
	return in_array( $taxonomy, $taxonomies );
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.