Skip to content

Instantly share code, notes, and snippets.

@mustardBees
Created October 26, 2022 08:15
Show Gist options
  • Save mustardBees/2df3170a5d1a41a6ec34114e4a56fe8d to your computer and use it in GitHub Desktop.
Save mustardBees/2df3170a5d1a41a6ec34114e4a56fe8d to your computer and use it in GitHub Desktop.
WordPress SQL query to return a count of each post type.
SELECT
post_type,
count(*)
FROM
wp_posts
GROUP BY
post_type
HAVING
count(*)
ORDER BY
count(*) DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment