LoginSignup
4
5

More than 5 years have passed since last update.

wordpressでタグに紐づく記事数を取得する方法

Posted at

wordpress初心者なのでメモ代わりに書く

参考にしたサイト

SQL

SELECT 
    t.name as タグ名,t.slug as スラグ, tt.count as 記事数
FROM
    wp_terms AS t
        INNER JOIN
    wp_term_taxonomy AS tt ON t.term_id = tt.term_id
WHERE
    tt.taxonomy = 'post_tag'
+-----------------------------------------------------+----------+-------+
| タグ名                                               | スラグ    | 記事数 |
+-----------------------------------------------------+----------+-------+
| タグ名1                                              | slug1    |    24 |
| タグ名2                                              | slug2    |    45 |
| タグ名3                                              | slug3    |    43 |
.
.
.

参考記事を元にquerylog漁ってたらとれた。

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5