If a meta worth within the WordPress user_meta
desk is about as a comma separated checklist and never a serialized worth, how can we evaluate an array of attainable values to the values within the database desk?
At present, we’re attempting this code, nevertheless it solely works if the Person
has just one worth; as quickly as there are a number of values, it turns into a comma separated string and does not match.
$args = array(
'function' => 'member',
'meta_query' => array(
'key' => 'specializations',
'worth' => array('physician', 'researcher'),
'evaluate' => 'IN'
)
);
$found_users = new WP_User_Query($args);
This solely works if the Person
‘s specialization
meta worth is both ‘physician
‘ or ‘researcher
‘, but when the Person
meta worth incorporates a number of values like physician, researcher
(or extra) then it returns nothing.
Assuming we won’t change how the meta values are created and saved within the first place, what’s one of the best ways to map an array of potential matches to a comma-separated string of values within the database?
The meant behaviour is that if you choose each ‘physician’ and ‘researcher’, the ensuing question will return anybody matching any or or the entire equipped values for the question.