好的,我将尝试添加此作为答案,因为我无法在注释中编写代码:
<?php
if($_GET[\'colour\'] && !empty ($_GET[\'colour\']))
{
$colours= $_GET[\'colour\']; //notice i pluralized.
}
?> //your code ended php, so i assume there is something here as it is not started again.
$meta_query = array(\'relation\' => \'OR\');
foreach ($colours as $colour) {
$meta_query[] = array(
\'key\' => \'colour\',
\'value\' => $colour, //not sure why you have parentheses, but try with and without here i guess
\'compare\' => \'like\', //switched back out of in because we are out of the array
);
}