我想知道如何过滤属性区域,我尝试:
<?php
$args = array(
'post_type' => 'estate_property',
'post_status' => 'publish',
'tax_query' => array(
'taxonomy' => 'property_area',
'field' => 'slug',
'terms' => 'pigalle',
),
);
$selection = new WP_Query($args);
?>
Run Code Online (Sandbox Code Playgroud)
但都表现出来了!为什么 ?哈哈
谢谢
阅读分类参数
tax_query 参数是一个多维数组。您需要用另一个数组包装它:
<?php
$args = array(
'post_type' => 'estate_property',
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'property_area',
'field' => 'slug',
'terms' => 'pigalle'
)
)
);
$selection = new WP_Query($args);
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22493 次 |
| 最近记录: |