尝试使用array_push将下面的数组添加到现有数组中:
'tax_query' => array(
'relation' => 'and',
array(
'taxonomy' => 'type',
'field' => 'slug',
'terms' => 'national'
)
)
现有数组:
$args = array(
'post_type' => 'events',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'events_start-date',
'value' => date('YYYY-mm-dd'),
'type' => 'CHAR',
'compare' => '>='
)
)
);
我试过这段代码没有运气:
array_push(
$args, array('tax_query'=> array('relation' => 'and',
array('taxonomy' => 'prince-range','field' => 'slug','terms' => '99')
)));