WP_Query not returning any posts

I’m used to writing complex WP queries, but am currently stumped. On a new website I have a dozen published posts, but the basic loop in WordPress doesn’t find them.

<?php

$the_query = new WP_Query($args);

if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo ‘<li>’ . get_the_title() . ‘</li>’;
}
} else {
echo ‘no posts found’;
}
wp_reset_postdata();

?>

I just get “no posts found” returned. What could the issue be?

Read more here:: WP_Query not returning any posts

Leave a Reply

Your email address will not be published. Required fields are marked *