wpseek.com
WordPress开发者和主题制作者的搜索引擎



is_object_in_taxonomy › WordPress Function

Since3.0.0
已弃用n/a
is_object_in_taxonomy ( $object_type, $taxonomy )
参数: (2)
  • (string) $object_type Object type string.
    Required: Yes
  • (string) $taxonomy Single taxonomy name.
    Required: Yes
返回:
  • (bool) True if object is associated with the taxonomy, otherwise false.
定义在:
文档:

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



源码

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 );
}