I have a custom WP_Query with the following meta_query:
$meta_query = array();
$meta_query['relation'] = 'AND';
if(!empty($postcode)) {
$meta_query[] = array(
'key' => 'postcode',
'value' => $postcode,
'compare' => 'LIKE'
);
}
if(!empty($email)) {
$meta_query[] = array(
'key' => 'email_address',
'value' => $email,
'compare' => 'LIKE'
);
}
The problem with this is WordPress is wrapping each meta value in %%
to use as part of the LIKE
comparison in the query e.g WHERE meta_value LIKE '%[email protected]%'
Is it possible to set up a meta_query so only one percentage sign is used, so we can check if a value starts with or ends with a phrase? e.g WHERE meta_value LIKE 'hello@%'