• Hello,

    I have a meta key called $availability, that can have one of four options, but also multiple values separated by “|”.

    So, for example the value could be
    “severaltimes_week| severaltimes_week| occasionally”.

    I haven’t found the right comparison for that issue. Can you help?
    ‘=’, ‘!=’, ‘>’, ‘>=’, ‘<‘, ‘<=’, ‘LIKE’, ‘NOT LIKE’, ‘IN’, ‘NOT IN’, ‘BETWEEN’, ‘NOT BETWEEN’, ‘EXISTS’, ‘NOT EXISTS’, ‘REGEXP’, ‘NOT REGEXP’,’RLIKE’

    if ( $_GET['ava1'] == "on" ) { $availability .= "severaltimes_week| "; }
    	if ( $_GET['ava2'] == "on" ) { $availability .= "oncetwice_week| "; }
    	if ( $_GET['ava3'] == "on" ) { $availability .= "severaltimes_week| "; }
    	if ( $_GET['ava4'] == "on" ) { $availability .= "occasionally"; }
    
    	$meta_args[] = array(
    		'key' => 'availability',
    		'value'   => $availability,
    		'compare' => 'IN'
    	);
  • The topic ‘Compare meta key separation’ is closed to new replies.