This core WordPress function works with CPT-onomies and DOES NOT require the CPT-onomy class.

You have been redirected from rachelcarden.com to my new home at WP Dreamer! I moved all my content over so you should be able to find everything you're looking for. If not, please let me know!


Retrieves the terms associated with the given object(s), in the supplied CPT-onomies.

As of 1.1, you can add the parameter ‘exclude’ to your $args array, specifying term ids to exclude from your results. ‘exclude’ can be defined as an array, comma- or space-delimited string and will only work if the ‘fields’ parameter is set to ‘ids’, ‘all’, or ‘all_with_object_id’.


 wp_get_object_terms( string|array $object_ids, string|array $cpt_onomies, string|array $args );


$object_ids (string|array) (required)
Default: none
The ID's of objects to retrieve terms from.

$cpt_onomies (string|array) (required)
Default: none
Name of the CPT-onomy to retrieve terms from. Can include multiple CPT-onomies.

$args (string|array) (optional)
Default: none
Arguments to customize what data is returned.
For information on how to customize the $args parameter, refer to the WordPress codex.

Return Values

(array|WP_error) The requested term data on success, an empty array if no terms are found, and a WP_error object if an invalid $cpt_onomy is entered.

Term object fields:

  • term_id - which is the same as the post ID
  • name
  • slug
  • term_group
  • term_taxonomy_id
  • taxonomy
  • description
  • parent
  • count


Returns a list of all 'actors' CPT-onomy terms (which are applied to $post) with a link to each term's archive page:
Note: You must use the $cpt_onomy class to retrieve the term's archive link ( get_term_link() ).


global $cpt_onomy;
$terms = wp_get_object_terms( $post->ID, 'actors' );
if ( $terms && !is_wp_error( $terms ) ) {
   echo '<ul>';
   foreach ( $terms as $term ) {
      echo '<li><a href="' . $cpt_onomy->get_term_link( $term, $term->taxonomy ) . '">' . $term->name . '</a></li>';
   echo '</ul>';


Related Functions

, , , , ,

WordPress Codex

For more information, refer to the WordPress codex.


Leave a Reply