How to find out the number of posts added to a given category – WordPress

<?php
 $posts = get_posts(array('category' => 5)); // Here 5 is  category id
 echo sizeof($posts);
?>

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>