【发布时间】:2014-03-07 06:24:00
【问题描述】:
我正在按元值进行自定义搜索并使用它:
print_r($_REQUEST);
$args = array(
'post_type' => 'property_post',
'posts_per_page' => 10,
'order' => 'ASC',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'custom_textarea',
'value' => 'me', // if I use static keyword it works
'compare' => 'LIKE'
),
array(
'key' => 'custom_price',
'value' => array( $_REQUEST['custom_price'], $_REQUEST['custom_price1'] ),
'type' => 'numeric',
'compare' => 'BETWEEN'
),
array(
'key' => 'custom_beds',
'value' => $_REQUEST['custom_beds'],
'compare' => '='
),
array(
'key' => 'custom_bath',
'value' => $_REQUEST['custom_bath'],
'compare' => '='
),
array(
'key' => 'custom_garage',
'value' => $_REQUEST['custom_garage'],
'compare' => '='
)
)
);
如果我对元值使用一些静态关键字,那么它可以工作,但使用 $_REQUEST 它没有。
我通过print_r($_REQUEST)检查了$_REQUEST。
Array ( [custom_textarea] => aa[custom_price] => 1000 [custom_price1] => 4000[custom_beds] => 2[custom_garage] => 1)
那我该怎么做才能让它好起来。
提前致谢…………
【问题讨论】:
标签: php wordpress search custom-post-type