Ok, so after deeper research I’ve found out that values of some custom fields created by ACF are stored in MySQL database with some additional information like a:5:{i:0;s:6:"Aerial";i:1;s:6:"Nature";i:2;s:4:"Nude";i:3;s:6:"People";i:4;s:8:"Wildlife";}
. This happens when a custom field can store multiple values (like chechboxes).
So I’ve edited part of my query from this:
if( !empty($_GET[‘theme’]) )
{
$contestTheme = explode(‘,’, $_GET[‘theme’]);
$contestThemeArray = array(
'key' => 'theme',
'value' => $contestTheme,
'compare' => 'IN',
);
}
To this:
if( !empty($_GET['contest_theme']) )
{
$contestTheme = explode(',', $_GET['contest_theme']);
$contestThemeArray = array('relation' => 'OR');
foreach ($contestTheme as $theme) {
$contestThemeArray[] = array(
'key' => 'contest_theme',
'value' => $theme,
'compare' => 'LIKE',
);
}
}