回答編集履歴

1

コードを WP 4.5.0以上に対応

2019/06/15 02:51

投稿

YukiYamashina
YukiYamashina

スコア1011

answer CHANGED
@@ -6,7 +6,7 @@
6
6
  > ➁「noun」の、「ja」の子ターム
7
7
  > ➂「adjective」の、「ja」の子ターム
8
8
 
9
- のすべてについて、「説明」欄にこの対象グループを特定できる共通のワード(例えば target)を入れておくと、[get_terms](http://wpdocs.osdn.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/get_terms) 関数第2引数 'description__like' を指定することでまとめて取得することが可能です。
9
+ のすべてについて、「説明」欄にこの対象グループを特定できる共通のワード(例えば target)を入れておくと、[get_terms](https://developer.wordpress.org/reference/functions/get_terms/) の引数 'description__like' を指定することでまとめて取得することが可能です。
10
10
 
11
11
  ```php
12
12
  <?php
@@ -16,8 +16,9 @@
16
16
  'adjective',
17
17
  );
18
18
  $args = array(
19
+ 'taxonomy' => $taxonomies,
19
20
  'hide_empty' => false,
20
21
  'description__like' => 'target',
21
22
  );
22
- $terms = get_terms( $taxonomies, $args );
23
+ $terms = get_terms( $args );
23
24
  ```