这个查询运行得很好,但现在我遇到了问题,因为我切换到了多站点。我添加了“global$switched”和“switch\\u to\\u blog(4)”,删除“tax\\u query”参数后效果很好!但当我把它加回来时,它不会返回任何结果。
global $switched;
switch_to_blog(4);
$args = array(
\'post_type\' => \'grille\',
\'posts_per_page\' => 1,
\'no_found_rows\' => true,
\'meta_key\' => \'heure_debut\',
\'orderby\' => \'meta_value\',
\'order\' => \'DESC\',
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'key\' => \'type_du_programme\',
\'value\' => \'emission\',
\'compare\' => \'=\'
),
array(
\'key\' => \'heure_debut\',
\'value\' => $current_time,
\'compare\' => \'<\'
)
),
\'tax_query\' => array(
array(
\'taxonomy\' => \'jours_de_diffusion\',
\'field\' => \'slug\',
\'terms\' => $current_day
)
)
);
$loop = new WP_Query( $args );