Query by Terms
// WP_Query arguments $args = array( 'post_type' => array( 'post' ), 'post_status' => array( 'published' ), 'tax_query' => array( array( 'taxonomy' => 'category', 'terms' => '$terms', 'field' => 'slug', ), ), ); // The Query $querybyterm = new WP_Query( $args ); // The Loop if ( $querybyterm->have_posts() ) { while ( $querybyterm->have_posts() ) { $querybyterm->the_post(); // do something } } else { // no posts found } // Restore original Post Data wp_reset_postdata();