Take the 2-minute tour ×  I am trying to echo the number of
posts for the current month from all categories but it isnt
working.  $month = date('m'); $year = date('Y'); $countposts =
get_posts('post_type=post&year=' . $year . '&monthnum=' . $month
. '&cat=3'); echo 'New posts '  . count($countposts);  category
3 is a parent category and has many sub categories. No matter
what I do, it returns the value 5. I have published 30 posts for
this month to test it but it doesnt count them. :(  What Im I
doing wrong?  Update I have tried the following query and
returns the same outpout  $current_year = date('Y');
$current_month = date('m'); $args = array(     'cat'      => 3,
'year'     => $current_year,     'monthnum' => $current_month,
'post_status'     => 'publish',     'post_type'       => 'post'
$number_posts = get_posts( $args ); echo 'New posts '  .
count($number_posts); share|improve this question Try using this
: $month = date('n'); –  Vinod Dalvi Feb 27 '13 at 13:04 Hi
thanks, same output, I even tri