is_object_in_taxonomy()
最后更新于:2021-11-27 09:30:24
is_object_in_taxonomy( string$object_type, string$taxonomy)Determine if the given object type is associated with the given taxonomy.
参数
- $object_type
-
(string) (Required) Object type string.
- $taxonomy
-
(string) (Required) Single taxonomy name.
响应
(bool) True if object is associated with the taxonomy, otherwise false.
源文件
文件: gc-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, true );
}