Skip to content

Instantly share code, notes, and snippets.

@stevenhoney
Last active September 22, 2016 08:30
Show Gist options
  • Save stevenhoney/f24e5a0c3d1766cc1fb245a4921b29da to your computer and use it in GitHub Desktop.
Save stevenhoney/f24e5a0c3d1766cc1fb245a4921b29da 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] ); // Assuming you will only add one number per post so first array item will be correct
if( $number > 100 && $number < 4000 ){
//Do stuf with posts in range 100 - 4000
}
endwhile;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment