Determines if the given object type is associated with the given taxonomy.
Parameters
$object_type
stringrequired- Object type string.
$taxonomy
stringrequired- Single taxonomy name.
Source
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 );
}
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.