我正在尝试在“tax_query”中回显$ zipcode_term。但它没有用......
wp_reset_query();
$zipcode_term = get_the_term_list( get_the_ID(), 'zipcode' );
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'zipcode',
'field' => 'slug',
'terms' => '.$zipcode_term.'
)
)
);
$query = new WP_Query( $args );
我已经回显了$ zipcode_term并且它正确显示它,所以我知道该部分正在工作,我怎样才能正确地在数组内部表达它?
答案 0 :(得分:0)
'terms' => '.$zipcode_term.'
应该在你的变量周围有撇号和连接吗?
'terms' => $zipcode_term