wt2
// WP_Query arguments
$args = array(
'post_type' => array( 'product' ),
'post_status' => array( 'publish' ),
'nopaging' => true,
'paged' => '1',
'posts_per_page' => '1',
'posts_per_archive_page' => '1',
'ignore_sticky_posts' => true,
'order' => 'DESC',
'orderby' => 'rand',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'programme_type',
'terms' => 'employer-led',
'field' => 'slug',
'operator' => 'IN',
'include_children' => true,
),
),
);
// The Query
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
// do something
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();