Skip to content

Instantly share code, notes, and snippets.

@saxap
Created December 21, 2015 17:41
Show Gist options
  • Save saxap/f543347c016ebad2d72b to your computer and use it in GitHub Desktop.
Save saxap/f543347c016ebad2d72b to your computer and use it in GitHub Desktop.
// only published term
$args = array();
$args['posts_per_page'] = 99999999999;
$args['post_type'] = 'ask';
$args['tax_query'] = array('relation' => 'AND');
$args['tax_query'][] = array(
'taxonomy' => 'qstatus',
'field' => 'id',
'terms' => array(19),
'operator' => 'NOT IN'
);
$not_published_ques = get_posts($args);
$not_ids = array();
foreach ($not_published_ques as $que) {
$not_ids[] = $que->ID;
}
global $wp_query;
$args = array();
$args['post__not_in'] = $not_ids;
query_posts(array_merge($args,$wp_query->query));
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment