WP_Query only returns posts that match first term in tax_query array
-
Hi!
I experienced the same issue on tax query.
The issue is that if you provide many keywords for one taxonomy array in tax query, you will only receive the first item for the post. check my code
$args = array( 'post_type' => 'product', 'posts_per_page' => -1, //'paged' => $paged, 'tax_query' => array( 'relation' => 'IN', array( 'taxonomy' => 'pa_size-mm', 'field' => 'slug', 'terms' => array('10','8-24-x-7-82'), 'operator' => 'OR', ), ) ); $loop = new WP_Query( $args ); $product_count = $loop->post_count; while ( $loop->have_posts() ) : $loop->the_post(); global $product; global $post; $test = $loop->post->ID; echo $test; echo "<br>"; endwhile;
Kindly help me
Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘WP_Query only returns posts that match first term in tax_query array’ is closed to new replies.