質問編集履歴
1
変数のスペルミスを修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
functions.phpに記述したいと思っています。
|
32
32
|
|
33
33
|
WPDocsを参考に下記を書いてみたのですが、
|
34
|
-
うまく
|
34
|
+
うまく抽出されないようです。
|
35
35
|
|
36
36
|
```php
|
37
37
|
//functions.php
|
@@ -40,7 +40,7 @@
|
|
40
40
|
function my_remove_cat()
|
41
41
|
{
|
42
42
|
global $wp_query;
|
43
|
-
$wp_query->
|
43
|
+
$wp_query->query_vars['tax_query'] = array(
|
44
44
|
'relation' => 'AND',
|
45
45
|
array(
|
46
46
|
'taxonomy' => 'my-custmon-category',
|
@@ -52,13 +52,6 @@
|
|
52
52
|
);
|
53
53
|
}
|
54
54
|
```
|
55
|
-
■エラー
|
56
|
-
Notice: Indirect modification of overloaded property
|
57
|
-
WP_Query::$query_posts has no effect in
|
58
|
-
\wordpress\wp-content\themes\twentysixteen\functions.php on line xxx
|
59
55
|
|
60
|
-
配列の書き換えができない、という旨なのでしょうが、
|
61
|
-
対応法がわからない状況です。
|
62
|
-
|
63
56
|
アドバイスをいただけないでしょうか。
|
64
57
|
よろしくお願いします。
|