Function: wp_get_object_terms

wp_get_object_terms( integer | array $object_ids, string | array $taxonomies, array | string $args )

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

Shortcut: wgot

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

Parameters

Name Type(s) Default Value Description
$object_ids integer | array

The ID(s) of the object(s) to retrieve.

$taxonomies string | array

The taxonomies to retrieve terms from.

$args array | string array()

See WP_Term_Query::__construct() for supported arguments.

Returns

array | WP_Error

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

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.