我已将此代码设置为管理wordpress中帖子页面列表中的过滤器。如果所有变量都不为null,则运行此筛选器,如下所示:?类型=公寓和;面积=基安蒂;价格=A
但当其中一个为空时,代码会给我一个空结果。我如何修复?
if(isset($type_search) OR isset($area_search) OR isset($prezzo_search)) {
$posts = get_posts(array(
\'posts_per_page\' => -1,
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'relation\' => \'AND\',
array(
\'key\' => \'villa_type_buy\',
\'value\' => $type_search,
\'compare\' => \'=\'
),
array(
\'key\' => \'Area\',
\'value\' => $area_search,
\'compare\' => \'=\'
)
),
array(
\'key\' => \'price_buy\',
\'value\' => array( $start_price, $end_price ),
\'type\' => \'numeric\',
\'compare\' => \'BETWEEN\'
)
)
));
}