Skip to content

Instantly share code, notes, and snippets.

@adamcrampton
Created November 6, 2018 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcrampton/1983f8011f09ed8c6e79a4f55b80ead4 to your computer and use it in GitHub Desktop.
Save adamcrampton/1983f8011f09ed8c6e79a4f55b80ead4 to your computer and use it in GitHub Desktop.
Get WordPress author post counts, within a date range, regardless of current access level
SELECT u.ID, u.display_name, COUNT(*)
FROM wp_posts p
RIGHT JOIN wp_users u ON p.post_author = u.ID
WHERE p.post_type = 'post'
AND p.post_status = 'publish'
AND p.post_date > '2017-11-01 00:00:00'
AND p.post_date < '2018-11-01 00:00:00'
-- Add any exclusions below
-- AND p.post_author NOT IN (8962, 90013, 9256, 52277)
GROUP BY u.display_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment