所以,我有一个自定义循环,它似乎在任何地方都能工作,只有一个地方。
$args = array(
\'post_type\' => \'post\',
\'meta_key\' => \'wpcf-post-weight\',
\'orderby\' => \'meta_value_num title\',
\'meta_query\' =>
array(
array(
\'key\' => \'wpcf-featured\',
\'value\' => -1,
),
array(
\'key\' => \'wpcf-news-expire-date\',
\'value\' => $today,
\'compare\' => \'>=\',
),
),
/*\'cat\'=> \'8\',*/
\'posts_per_page\' => 1
);
$alertloop = new WP_Query( $args );
注释掉cat=>8后,查询变量如下所示Array
(
[post_type] => post
[meta_key] => wpcf-post-weight
[orderby] => meta_value_num title
[meta_query] => Array
(
[0] => Array
(
[key] => wpcf-featured
[value] => -1
)
[1] => Array
(
[key] => wpcf-news-expire-date
[value] => 1383047207
[compare] => >=
)
)
[posts_per_page] => 1
[error] =>
[m] =>
[p] => 0
[post_parent] =>
然而,只要我取消对cat=>8的注释,它就会删除第一个meta\\u查询。Array
(
[post_type] => post
[meta_key] => wpcf-post-weight
[orderby] => meta_value_num title
[meta_query] => Array
(
[0] => Array
(
[key] => wpcf-news-expire-date
[value] => 1383046582
[compare] => >=
)
)
[cat] => 8
[posts_per_page] => 1
[error] =>
[m] =>
这在Wordpress 3.7中。我不认为这有什么区别,但我尝试重新排列$args订单,但都没有用。任何见解都将不胜感激。非常感谢。