is_object_in_term()判断文章是否属于某个分类类型

目录

描述

Determines if the given object is associated with any of the given terms.

The given terms are checked against the object’s terms’ term_ids, names and slugs. Terms given as integers will only be checked against the object’s terms’ term_ids. If no terms are given, determines if object is associated with any terms in the given taxonomy.

is_object_in_term() 描述

用法

<?php is_object_in_term$object_id$taxonomy$terms null ?>

is_object_in_term() 用法

参数

$object_id

(integer) (必填) ID of the object to check. (post ID, link ID, etc.)

默认值: None

$taxonomy

(string) (必填) A single taxonomy name.

默认值: None

$terms

(mixed) (可选) The term ID, name or slug or an array of such.

默认值: NULL

is_object_in_term() 参数

返回值

(boolean|mixed)

True if associated, false if not associated. WP_Error on input error.

is_object_in_term() 返回值

示例

is_object_in_term() 示例

源文件

is_object_in_term() 函数的代码位于 wp-includes/taxonomy.php.

is_object_in_term() 源文件

相关