get_object_term_cache

SummerySummery

Retrieves the cached term objects for the given object ID.

Syntax

get_object_term_cache( int $id, string $taxonomy )

DescriptionDescription

Upstream functions (like get_the_terms() and is_object_in_term()) are responsible for populating the object-term relationship cache. The current function only fetches relationship data that is already in the cache.

ParametersParameters

$id

(int) (Required) Term object ID, for example a post, comment, or user ID.

$taxonomy

(string) (Required) Taxonomy name.

ReturnReturn

(bool|WP_Term[]|WP_Error) Array of WP_Term objects, if cached. False if cache is empty for $taxonomy and $id. WP_Error if get_term() returns an error object for any term.

SourceSource

File: wp-includes/taxonomy.php


			

ChangelogChangelog

Changelog
Version Description
4.7.0 Returns a WP_Error object if there's an error with any of the matched terms.
2.3.0 Introduced.
Scroll to Top