[wp-trac] [WordPress Trac] #42082: Support compare custom fields in WP_Meta_Query
WordPress Trac
noreply at wordpress.org
Wed Oct 4 01:30:52 UTC 2017
#42082: Support compare custom fields in WP_Meta_Query
-------------------------+-----------------------------
Reporter: mariovalney | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
The syntax of `WP_Meta_Query` currently is limited to values you already
know.
It's not possible to compare between two meta_values:
{{{
SELECT posts WHERE meta_value_one > meta_value_two
}}}
I propose allow compare two meta_fields. For example, the pseudocode above
would be represented as a meta_query argument that looks like this:
{{{#!php
<?php
array(
'key' => 'meta_value_one',
'value' => 'meta_value_two',
'compare' => '>',
'type' => 'META_VALUE'
),
}}}
A workaround can be found [https://wordpress.stackexchange.com/a/164041
here] and
[https://gist.github.com/mariovalney/e8646d8c64db36e9f239e6d05f2e5923
here] hahaha.
Feedback is welcome.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42082>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list