wp_get_object_terms

SummerySummery

Retrieves the terms associated with the given object(s), in the supplied taxonomies.

Syntax

wp_get_object_terms( int|int[] $object_ids, string|string[] $taxonomies, array|string $args = array() )

ParametersParameters

$object_ids

(int|int[]) (Required) The ID(s) of the object(s) to retrieve.

$taxonomies

(string|string[]) (Required) The taxonomy names to retrieve terms from.

$args

(array|string) (Optional) See WP_Term_Query::__construct() for supported arguments.

Default value: array()

ReturnReturn

(array|WP_Error) The requested term data or empty array if no terms found. WP_Error if any of the taxonomies don't exist.

SourceSource

File: wp-includes/taxonomy.php


			

ChangelogChangelog

Changelog
Version Description
4.7.0 Refactored to use WP_Term_Query, and to support any WP_Term_Query arguments.
4.4.0 Introduced $meta_query and $update_term_meta_cache arguments. When $fields is 'all' or 'all_with_object_id', an array of WP_Term objects will be returned.
4.2.0 Added support for 'taxonomy', 'parent', and 'term_taxonomy_id' values of $orderby. Introduced $parent argument.
2.3.0 Introduced.
Scroll to Top