Question

i've saved and array of 'open days' as a serialised array in a meta value.

I was hoping i could then just search this field for the selected dates but i can't seem to create a match.

serialised = a:2:{i:0;s:10:"2011-09-16";i:1;s:10:"2011-09-17";} ; // two open dates

and was trying this and some variation without luck ;

$values_serialized = serialize(array('2011-09-16')); // need to serialise???

$args =  array ('meta_query' => array( 
    array( 'key'=>'v-openDays', 'value'=>$values_serialized,'compare'=>'IN' ) 
  )
)
// IN or LIKE?

will also be searching for multiple days but need to get one working first! Help appreciated, Dc

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top