函数原型
is_object_in_taxonomy( string $object_type, string $taxonomy ): bool
函数描述
Determines 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.
函数位置
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, true );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |

