Created
February 6, 2019 00:24
-
-
Save adamcrampton/4f3184c1346917cd6f6fac566e099b85 to your computer and use it in GitHub Desktop.
Count all posts in WordPress database by tag or category, and output daily totals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT p.post_date, COUNT(*) FROM wp_posts p | |
JOIN wp_term_relationships tr | |
ON p.ID = tr.object_id | |
WHERE tr.term_taxonomy_id = 15996 | |
AND p.post_status = "publish" | |
AND p.post_type = "post" | |
AND p.post_date > "2017-02-06" | |
GROUP BY YEAR(p.post_date), MONTH(p.post_date), DAY(p.post_date) | |
ORDER BY p.post_date ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment