Something seems wrong with WP_Query, how to debug?
-
Hi there,
I have a custom loop inside a “single”-template for a custom post type:
$posts_list = new WP_Query( array ( 'post_type' => 'post', 'posts_per_page' => -1, 'meta_key' => 'customFieldXY', 'meta_value' => 'value' ) ); if ( $posts_list->have_posts() ) { while ( $posts_list->have_posts() ) : $posts_list->the_post(); echo get_the_title(); endwhile; }Besides the expected results there are also some posts showing up, that do not match these criterias. I also tried something simplier like
'post__in' => array( 2, 5, 12, 14, 20 )and got the same error with the same strange posts showing up. What is wrong with the query? Is there any possibility to debug and get a better understanding what the query does and what goes wrong?Thanks
Marcel
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
The topic ‘Something seems wrong with WP_Query, how to debug?’ is closed to new replies.