get posts returns results but wp_query does not
The main problem is a misunderstanding of PHP objects and the 2 methods you’re using: $a = get_posts( … ); $b = new WP_Query( … ); $a is an array of WP_Post objects e.g. foreach ( $a as $p ) { … } $b is an object of type WP_Query e.g. while ( $b->have_posts() ) … Read more