很抱歉回答我自己的问题,但这也可能对其他开发人员有所帮助。
我创建了这个额外的过滤器“json\\u query\\u var-meta\\u query”,它返回必要的参数。
function adjustQrry($data){
$args = array();
$args[\'relation\'] = \'AND\';
foreach ($data as $key=>$value) {
if ( \'relation\' === $key ) {
$args[\'relation\'] = $data[\'relation\'];
}
if ( substr($key, 0, 3) === \'key\' ) {
$arg_num = substr($key, 3);
$args[(int)$arg_num][\'key\'] = $value;
}
if ( substr($key, 0, 7) === \'compare\' ) {
$arg_num_comp = substr($key, 7);
$args[(int)$arg_num_comp][\'compare\'] = $value;
}
}
return $args;
}
add_filter(\'json_query_var-meta_query\', \'adjustQrry\', 10, 1);
现在,我可以这样调用JSON restful来模拟服务器上已有的Wp\\U查询帖子过滤器:
?filter[meta_query][key]=_newsml_categories_newsstream&filter[meta_query][key2]=homepage&filter[meta_query][relation]=AND&filter[meta_query][compare]=NOT%20EXISTS&filter[meta_query][compare2]=NOT%20EXISTS
参考号:
https://github.com/WP-API/WP-API/issues/337