I'm trying to use the LIKE operator for the meta_query parameter but it seems that it automatically wraps "%" on the meta value.
An example:
'meta_query' => array(
array(
'key' => 'surname',
'compare' => 'LIKE',
'value' => 'ab'
)
)
This functions as LIKE '%ab%'
in the generated SQL.
What I want to do is only use wildcards AFTER the the meta value, so it should be: LIKE 'ab%'
. I can't find a way to achieve this though, is there a built-in function for this that I missed somewhere? Or am I better off using a direct query to the database?
Thanks!