[wp-hackers] Limiting get_users() results by meta value
mpwalsh8 at gmail.com
Fri Feb 1 19:37:36 UTC 2013
Bummer - I was hoping I had simply missed something.
I like the idea of a 'like_escape' => false option and am willing to try
and do a patch. I took a look through the code and it appears the patch
needs to be applied to meta.php. I have something up and running, I will
try and generate a patch and open a Trac ticket. I had to call the new
argument 'meta_like_escape' to get it to work as the 'meta_' prefix is
assumed in WP_Meta_Query.
On Fri, Feb 1, 2013 at 11:24 AM, Andrew Nacin <wp at andrewnacin.com> wrote:
> On Fri, Feb 1, 2013 at 11:13 AM, Mike Walsh <mpwalsh8 at gmail.com> wrote:
> > As 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. I can't seem to find what I
> > am searching for when I Google it, can anyone point me to an example of
> > to do what I want to do?
> 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.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
Mike Walsh - mpwalsh8 at gmail.com
More information about the wp-hackers