Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stevenhoney/e8319c2081d5b3aa296e3c5e1b34130c to your computer and use it in GitHub Desktop.
Save stevenhoney/e8319c2081d5b3aa296e3c5e1b34130c to your computer and use it in GitHub Desktop.
$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'your_taxonomy_slug'
),
),
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) : $query->the_post();
$terms = wp_get_post_terms( $post->ID, 'your_taxonomy_slug', 'names' );
$number = absint( $terms[0] );
if( $number > 100 && $number < 4000 ){
//Do stuf with posts in range
}
endwhile;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment