0

我试图在“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 并且它正确显示了它,所以我知道该部分正在工作,我怎样才能正确地在数组内部表达它?

4

1 回答 1

0

变量周围应该'terms' => '.$zipcode_term.'有撇号和连接吗?

'terms' => $zipcode_term

?

于 2012-09-26T23:04:06.840 回答