Skip to content

Instantly share code, notes, and snippets.

@richaber
Created January 23, 2023 17:03
Show Gist options
  • Save richaber/4555f1c99f0bfc129e90baf241ca9fe9 to your computer and use it in GitHub Desktop.
Save richaber/4555f1c99f0bfc129e90baf241ca9fe9 to your computer and use it in GitHub Desktop.
Get count of posts for "non-standard" post formats in MySQL
mysql> SELECT 
    ->     t1.slug, t2.count
    -> FROM
    ->     local.wp_terms AS t1
    ->         INNER JOIN
    ->     local.wp_term_taxonomy AS t2 ON t1.term_id = t2.term_id
    -> WHERE
    ->     t2.taxonomy = 'post_format';
+---------------------+-------+
| slug                | count |
+---------------------+-------+
| post-format-gallery |    51 |
| post-format-video   |   192 |
| post-format-link    |     0 |
+---------------------+-------+
3 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment