$idarray=array; $data = array post_type = qqproduct post_status = publish orderby = DATE order = DESC posts_per_page = $per_page paged = $paged ;$meta_query = array; Initialize the meta
Here is the revised else condition added to the code:
} else {
if ($value) {
$stros = explode(",", $value);
$trainer_query = array('relation' => 'OR');
foreach ($stros as $stro) {
$trainer_query[] = [
'key' => 'qq_att_' . $key,
'value' => $stro,
'compare' => 'LIKE',
];
$keys[] = $stro;
}
$meta_query[] = $trainer_query;
}
}
This else condition checks if the value is not empty and then creates a meta query for the given key and value. The meta query is then added to the existing meta query array
原文地址: http://www.cveoy.top/t/topic/iwL9 著作权归作者所有。请勿转载和采集!