[wp-trac] [WordPress Trac] #42409: Add LIKE support to meta_key comparisons in WP_Meta_Query
WordPress Trac
noreply at wordpress.org
Mon Nov 6 16:00:06 UTC 2017
#42409: Add LIKE support to meta_key comparisons in WP_Meta_Query
-------------------------------------------------+-------------------------
Reporter: Otto42 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
Component: Database | Review
Severity: normal | Version: trunk
Keywords: good-first-bug needs-unit-tests | Resolution:
has-patch | Focuses:
-------------------------------------------------+-------------------------
Comment (by mariovalney):
I agree with @dd32 but I thought it would be elucidated by documentation.
My mistake.
Particularly I was inclined to suggest to allow as-is as the LIKE
expression, if there is a '%' inside meta_key value because it's more
natural to developers and it's not trivial in meta_key names (keeping the
"CONTAINS behavour" to backwards compatibility if there's no '%' in name)
but as @Otto42 pointed we should take care of "_" too and it's very
trivial to be used in meta_key / meta_value string.
So... maybe creating a "RAW_LIKE / SQL_LIKE" comparator? Or keeping the
"CONTAINS behavour" and create a filter to allow as-is values?
''Anyway 42409.2.diff corrects the consistency between meta_key and
meta_value LIKEs so we can talk about using as-is expressions.''
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42409#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list