Using the following code, how can I do the search by ignoring the case of the field in the database :
$args = array(
'meta_query' => array(
'relation' => 'OR',
array(
array(
'key' => 'province',
'value' => 'kzn',
'compare' => '='
),
)
)
);
$user_query = new WP_User_Query( $args );
In the above example, 'kzn' is stored as KZN in the database. The input search string can be 'Kzn', or 'kZn... etc. The value to search for can also be a mixed bag as far as it's case goes. So I guess what I am looking for is a war to search for uppercase(databasefield) in the value field, if that makes sense.
Thank you.
Got it.
(
'key' => 'province',
'value' => ('^'.$province),
'compare' => 'REGEXP'
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With