用于元查询的 ACF 转发器子字段
ACF repeater subfield for meta query
这是我的元查询..(var_dump模式)
array(2) {
["relation"]=> string(3) "AND"
[0]=> array(2) {
["relation"]=> string(2) "OR"
[0]=> array(3) {
["key"]=> string(17) "status_$_bedrooms"
["value"]=> string(1) "1"
["compare"]=> string(1) "="
}
}
}
我设置了更多的嵌套元查询以防其他字段有任何值..
这是一个转发器子字段的情况我添加了以下过滤器但没有运气..我不知道是否与我的查询结构有关
function my_posts_where( $where ) {
$where = str_replace("meta_key = 'status_$", "meta_key LIKE 'status_%", $where);
return $where;
}
add_filter('posts_where', 'my_posts_where');
有什么建议吗?谢谢!
我解决了问题..
该值是字符串..我必须使用 intval() 将其转换为整数以将数字与数字
进行比较
这是我的元查询..(var_dump模式)
array(2) {
["relation"]=> string(3) "AND"
[0]=> array(2) {
["relation"]=> string(2) "OR"
[0]=> array(3) {
["key"]=> string(17) "status_$_bedrooms"
["value"]=> string(1) "1"
["compare"]=> string(1) "="
}
}
}
我设置了更多的嵌套元查询以防其他字段有任何值.. 这是一个转发器子字段的情况我添加了以下过滤器但没有运气..我不知道是否与我的查询结构有关
function my_posts_where( $where ) {
$where = str_replace("meta_key = 'status_$", "meta_key LIKE 'status_%", $where);
return $where;
}
add_filter('posts_where', 'my_posts_where');
有什么建议吗?谢谢!
我解决了问题.. 该值是字符串..我必须使用 intval() 将其转换为整数以将数字与数字
进行比较