Try to remove the % only on the filter here:
$where = str_replace("meta_key = 'dates_", "meta_key LIKE 'dates_", $where);
Can you execute the following and then send to us after $query?
<?php echo '<pre>'; var_export($the_query); echo '</pre>'; ?>
Inspecting the $the_query I noticed a difference on the select. Previously was something like this:
cnfn_postmeta.meta_key = \'locations_%_city\'
but now it looks like:
cnfn_postmeta.meta_key = \'locations_{f12d517a894ce203cd99a63423903c99584233ad4535dc2d10f20cb2029ad0e7}_city\'
So… removing the % on the filter I fixed the bug (that means now $the_query->have_posts() returns posts) but I’m not sure is a real fix.
old code:
$where = str_replace("meta_key = 'locations_%", "meta_key LIKE 'locations_%", $where);
new code:
$where = str_replace("meta_key = 'locations_", "meta_key LIKE 'locations_", $where);
Please, someone more expert can confirm if it’s correct?
I need this feature too. Thanks.