Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a conditional tag (or a similar concept) that can tell me wether the search returned posts or not?

share|improve this question

1 Answer 1

global $wp_query;
echo $wp_query->found_posts;
share|improve this answer
Or if( have_posts() ) should pretty much do the same, ie. tell you if there are more than 0 posts returned in the query. – t31os Jan 22 '11 at 10:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.