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);
?>

6 thoughts on “How to find out the number of posts added to a given category – WordPress”

  1. Hi, I think your site could be having web browser compatibility issues.
    Whenever I look at your website in Safari, it looks fine but when opening in
    Internet Explorer, it has some overlapping issues. I simply wanted to
    give you a quick heads up! Apart from that, great site!

  2. I’ve been exploring for a little for any high quality articles or blog posts on this sort of area . Exploring in Yahoo I ultimately stumbled upon this website. Reading this info So i am glad to exhibit that I’ve a
    very excellent uncanny feeling I discovered just what I needed.
    I such a lot indubitably will make certain to don?
    t forget this site and give it a glance regularly.

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=""> <strike> <strong>