I am searching for a method to fetch posts in wordpress which are slated for future publication with different custom taxonomy query. Finding future posts is otherwise, simple


But adding a custom taxonomy does not act as expected


I wound up while using $wpdb and writing the SQL manually and joining the terms, taxonomy and associations tables together.

$sql = "SELECT post.* 
  FROM {$wpdb->prefix}terms term 
  JOIN {$wpdb->prefix}term_taxonomy taxonomy
  JOIN {$wpdb->prefix}term_relationships relationship
  JOIN {$wpdb->prefix}posts post
  WHERE term.term_id = taxonomy.term_id
  AND relationship.term_taxonomy_id = taxonomy.term_taxonomy_id
  AND term.slug = '%s'
  AND taxonomy.taxonomy = '%s'
  AND post.ID = relationship.object_id";

if($posts = $wpdb->get_results( $wpdb->prepare($sql, $term->slug, $term->taxonomy) )):      
  foreach($posts as $post):
     the_ID().' '.the_title().'\n<br/>';

This works but I am wishing that there's a method to accomplish exactly the same but while using Wordpress API (query_posts, Wordpress_Query, get_posts etc)!

You actually can...

$events = get_posts('numberposts=-1&post_type=events&musicians=paul-mccartney&post_status=future&order=ASC');
foreach($events as $event){

        echo '<a href="'.get_permalink($event->ID).'">'.$event->post_title.'</a>';


You should use exactly the same parameters as with http://codex.wordpress.org/Function_Reference/WP_Query#Parameters