Using a pre_get_posts filter to search for multiple strings on all meta values
-
31-10-2019 - |
سؤال
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!
لا يوجد حل صحيح
لا تنتمي إلى wordpress.stackexchange