wordpress : get all category names with the number of post in each category

a sql query to print all category names with the number of post in
each category for each month


"SELECT count(*), wp_terms.name FROM wp_term_taxonomy AS
wp_term_taxonomy INNER JOIN wp_terms ON wp_term_taxonomy.term_id =
wp_terms.term_id INNER JOIN wp_term_relationships ON
wp_term_taxonomy.term_taxonomy_id =
wp_term_relationships.term_taxonomy_id INNER JOIN wp_posts ON
wp_term_relationships.object_id = wp_posts.ID WHERE
wp_posts.post_status = 'publish' AND wp_posts.post_type = 'post' AND
wp_term_taxonomy.taxonomy = 'category' and wp_posts.post_date like
'2011-11' GROUP BY wp_terms.name

No comments:

Other Articles

Enter your email address: