This WordPress function requires the CPT-onomy class.


Retrieve the IDs of the objects who are tied to a valid CPT-onomy and term.


$cpt_onomy->get_objects_in_term( 						int|array
						, 						string|array
						, 						string|array


$term_ids (integer|array) (required)
Default: none
Term id or array of term ids of terms that will be used.

$cpt_onomies (string|array) (required)
Default: none
String of CPT-onomy name or Array of string values of CPT-onomy names.

$args (string|array) (optional)
Default: none
Change the order of the object_ids, either ASC or DESC.
For information on how to customize the $args parameter, refer to the WordPress codex.

Return Values

(array|WP_Error) If the CPT-onomy does not exist, then WP_Error will be returned. On success the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.


Note: You can also use a taxonomy query with the Loop to achieve the same results.


$objects = $cpt_onomy->get_objects_in_term( get_the_id(), 'actors' );

$args = array(
   'post_type' => 'movies',
   'post__in' => $objects,
   'orderby' => 'title',
   'order' => 'ASC',

query_posts( $args );
if ( have_posts() ) :
      while ( have_posts() ) : the_post();
         ?><li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li><?php



  • Since 1.0.2

WordPress Codex

For more information, refer to the WordPress codex.