• Hi,

    I use the custom field filter (https://bit.ly/1TdWZpB) to filter my posts by a custom field called “year”, which works very good.

    However, my search query often has two values or more for this custom field; in these cases, neither

    &year=2015,2014,2013 nor year[]=2015&year[]=2014&year[]=2013 work.

    In the first case, I get only results from the first value (here 2015). In the second case, I get all results (so not restricted at all).

    How can I make Relevanssi restrict the search results to multiple values of one custom field?

    Thank you ??

    https://www.ads-software.com/plugins/relevanssi/

Viewing 1 replies (of 1 total)
  • Plugin Author Mikko Saari

    (@msaari)

    A multi-value meta query looks like this:

    $meta_query = array(
    	array(
    		'key' 		=> 'colour_field',
    		'value'		=> $array_of_values,
    		'compare' 	=> 'IN',
    	),
    );

    So you need to edit the function so that it reads the comma-separated values and explodes them into an array.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom field filter: Several values possible?’ is closed to new replies.