I’m doing a query:
It is possible that get the actual count of returned posts,I use this:
$sitens = new wp_query( array ( 'post_type' => 'post' , 'post__in' => array($post_id) ) );
$numResults = $sitens->post_count;
if ( $sitens->have_posts() ) : while ( $sitens->have_posts() ) : $sitens->the_post();
echo $numResults;
endwhile; endif;
If the $post_id = ('44','53','4453');
it must be the value of $numResults
= 3 ,
But its show me 1;
Thanks in advance.
Use $sitens->found_posts; instead. I believe post_count shows the amount of posts being displayed while found_posts shows the total number of posts returned by the query.