回答編集履歴
1
情報の追加。
answer
CHANGED
@@ -11,4 +11,18 @@
|
|
11
11
|
[https://developer.wordpress.org/reference/functions/is_category/](https://developer.wordpress.org/reference/functions/is_category/)
|
12
12
|
|
13
13
|
【現在のカテゴリーIDを取得する8種の方法 ? WordPress Snippet】
|
14
|
-
[http://tenman.info/labo/snip/archives/7741](http://tenman.info/labo/snip/archives/7741)
|
14
|
+
[http://tenman.info/labo/snip/archives/7741](http://tenman.info/labo/snip/archives/7741)
|
15
|
+
|
16
|
+
|
17
|
+
---
|
18
|
+
|
19
|
+
**追記:**
|
20
|
+
|
21
|
+
色々なものが動かない理由がいまいち掴めませんが、ループでis_categoryするのであれば下記のようにすれば出来ると思います。
|
22
|
+
|
23
|
+
```PHP
|
24
|
+
foreach ( array( 1, 2, 3, 4, 5,… ) as $tmp_cat_id ) {
|
25
|
+
if ( !is_category( $tmp_cat_id ) ) { continue; }
|
26
|
+
$hoge = $tmp_cat_id;
|
27
|
+
}
|
28
|
+
```
|