Question

Using a pre_get_posts filter to search a given string on all meta_values:

$query->set('meta_value', 'first string');

debug:

AND ( (CAST(wp_postmeta.meta_value AS CHAR) = 'first string') )

Works Ok :) but how can I search on all meta_values for an array of strings?

For example. I need something like:

$query->set('meta_value', array('first string', 'second string'));

AND ( (CAST(wp_postmeta.meta_value AS CHAR) = 'first string') OR (CAST(wp_postmeta.meta_value AS CHAR) = 'second string') )

It is possible using $query->set('meta_value'... or something else?

Thanks in advance!

No correct solution

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