WP_Query strange results
-
Hi
I have this function with WP query and some args, it give the correct number of items found ( 1), but the loop gives me 4 items ( all the stickys post)$args = array( ‘post_type’ => ‘post’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘rubriques’, ‘value’ => ‘178’, ‘compare’ => ‘LIKE’, ), ), ‘post__in’ =>get_option( ‘sticky_posts’ ) ); $caroussel_query = new WP_Query( $args ); echo ‘<br>’ . $caroussel_query->found_posts . ‘<br>’; if ( $caroussel_query->have_posts() ) { while ( $caroussel_query->have_posts() ) { $caroussel_query->the_post(); echo the_ID() . ‘<br>’; } }query->found_posts give 1. it is correct
but the loop shows 4 ids.
Please note that the “rubriques” field is an ACF serialized arrayThanks for your help
GillesGilles
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘WP_Query strange results’ is closed to new replies.