WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #23373

Timestamp:
02/03/13 06:56:27 (5 months ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #23373

    • Property Version changed from trunk to 3.5
  • Ticket #23373 – Description

    initial v1  
    22 
    33Here arr the args I am passing to get_users(): 
     4{{{ 
    45( 
    56    [include] => 
     
    1011    [meta_compare] => LIKE 
    1112) 
    12  
     13}}} 
    1314This is the query the WordPress constructs for me: 
    14  
     15{{{ 
    1516[01-Feb-2013 16:01:08 UTC] WP_User_Query Object 
    1617( 
     
    4950    [query_limit] => 
    5051 
    51  
     52}}} 
    5253---- 
    5354 
    5455As you can see, the LIKE clause is escaped and wrapped with SQL wildcard operators.  I can't figure out how to prevent this from happening as what I want is "LIKE 'M%'" to be my actually query. 
    5556 
    56 '' 
    57 Andrew Nacin wp@andrewnacin.com via lists.automattic.com  
    58 11:24 am (1 day ago) to wp-hackers  
     57 Andrew Nacin wp@andrewnacin.com via lists.automattic.com  
     58 11:24 am (1 day ago) to wp-hackers  
    5959 
    60 Currently, "LIKE" prepends and appends wildcards, as in %term%. We could add "%LIKE" and "LIKE%", though that would not help with the situation where you want LIKE taken literally, potentially without % wildcards at all. (Such as using _ as a single-character wildcard, or looking for case insensitive matching.) Probably the best way to add to this API would be to allow for a 'like_escape' => false; that would accept your value as provided. If you'd like to submit a ticket (and patch), this can definitely find its way into 3.6. 
     60 Currently, "LIKE" prepends and appends wildcards, as in %term%. We could add "%LIKE" and "LIKE%", though that would not help with the situation where you want LIKE taken literally, potentially without % wildcards at all. (Such as using _ as a single-character wildcard, or looking for case insensitive matching.) Probably the best way to add to this API would be to allow for a 'like_escape' => false; that would accept your value as provided. If you'd like to submit a ticket (and patch), this can definitely find its way into 3.6. 
    6161 
    62 Nacin'' 
     62 Nacin 
    6363 
    6464