is_object_in_taxonomy()
Determine if the given object type is associated with the given taxonomy.
Uses: get_object_taxonomies()
1 time — 0.000029 sec (very fast) | 50000 times — 0.24 sec (very fast) | PHP 7.1.1, WP 4.7.2
No Hooks.
Return
true|false
. True if object is associated with the taxonomy, otherwise false.
Usage
is_object_in_taxonomy( $object_type, $taxonomy );
- $object_type(string) (required)
- Object type string.
- $taxonomy(string) (required)
- Single taxonomy name.
Changelog
Since 3.0.0 | Introduced. |
Code of is_object_in_taxonomy() is object in taxonomy WP 6.0
function is_object_in_taxonomy( $object_type, $taxonomy ) { $taxonomies = get_object_taxonomies( $object_type ); if ( empty( $taxonomies ) ) { return false; } return in_array( $taxonomy, $taxonomies, true ); }