Last active
March 18, 2021 13:46
-
-
Save rdlmda/e6363f78893d438917c1bba87326cd4d to your computer and use it in GitHub Desktop.
WordPress: count posts by year and month
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 YEAR(post_date) YEAR, MONTH(post_date) MONTH, COUNT(*) COUNT | |
| FROM wp_posts | |
| WHERE post_type = 'post' AND post_status = 'publish' | |
| GROUP BY YEAR(post_date), MONTH(post_date); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment