[wp-trac] [WordPress Trac] #19738: meta_query should check for wildcards when using LIKE operator

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 5 18:07:01 UTC 2012


#19738: meta_query should check for wildcards when using LIKE operator
-------------------------+------------------------------
 Reporter:  ejdanderson  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:  3.2
 Severity:  normal       |  Resolution:
 Keywords:  2nd-opinion  |
-------------------------+------------------------------

Comment (by ejdanderson):

 Replying to [comment:1 scribu]:
 > I'm on the fence on this one. I don't think we expose MySQL's '%'
 wildcards anywhere ATM.

 I dont think so either, there are a few places in the code that act in a
 similar way `get_terms()` for example, although in that case its a search
 parameter and seems appropriate.

 I can see why exposing this is a bad idea, we don't want user input to be
 able to set SQL wildcards.

 There have been numerous times though when I need to filter in custom SQL
 for a LIKE operator. A large majority of these have been to remove the
 leading '%'. Maybe a better solution is a flag to describe where '%'
 should be set - preceding, trailing, or both.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19738#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list