is_object_in_term

SummerySummery

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

Syntax

is_object_in_term( int $object_id, string $taxonomy, int|string|array $terms = null )

DescriptionDescription

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.

ParametersParameters

$object_id

(int) (Required) ID of the object (post ID, link ID, ...).

$taxonomy

(string) (Required) Single taxonomy name.

$terms

(int|string|array) (Optional) Term term_id, name, slug or array of said.

Default value: null

ReturnReturn

(bool|WP_Error) WP_Error on input error.

SourceSource

File: wp-includes/taxonomy.php


			

ChangelogChangelog

Changelog
Version Description
2.7.0 Introduced.
Scroll to Top