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


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’.

If you are using CPT-onomies and taxonomies and are trying to retrieve both CPT-onomy and taxonomy term information in the same request: the most important thing to understand is that CPT-onomy information is stored differently than regular taxonomy information so if you’re using wp_get_object_terms(), there’s a small chance WordPress might get a little confused. The easiest solution? When you are using wp_get_object_terms(), or something similar, request ‘all’ or ‘all_with_object_id’ fields. If WordPress has to retrieve all of the term information, it eliminates the chance that a CPT-onomy or taxonomy term will be overwritten and lost in the shuffle.


wp_get_object_terms( 						string|array
						, 						string|array
						, 						string|array


$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>';


WordPress Codex

For more information, refer to the WordPress codex.