× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Checking if WP_Query found any posts

Douglas Crosby
Apr 09, 2015
<p><span style="color:rgb(95, 99, 102)">WP_Query needs to be checked for posts using WordPress' have_posts function, not if($query). You technically could also check if ($query-&gt;found_posts &gt; 0), but the built in functions tend to be easier to use.</span></p>
comments powered by Disqus