[wp-trac] [WordPress Trac] #42082: Support compare custom fields in WP_Meta_Query

WordPress Trac noreply at wordpress.org
Wed Feb 28 13:32:40 UTC 2018


#42082: Support compare custom fields in WP_Meta_Query
-------------------------+------------------------------
 Reporter:  mariovalney  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:  4.9.4
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:
-------------------------+------------------------------
Changes (by mariovalney):

 * keywords:   => needs-patch
 * version:   => 4.9.4


Comment:

 Fixing the proposed example (the parametes should be the key, not the
 value):

 {{{#!php
 <?php
 array(
     'key'       => 'meta_key_one',
     'value'     => 'meta_key_two',
     'compare'   => '>',
     'type'      => 'META_VALUE'
 ),
 }}}

 And proposing another approach to keep consistency in 'type' parameter
 (because its values are SQL data types) maybe we can add a new parameter
 (which will be ignored if "value" is presented):

 {{{#!php
 <?php
 array(
     'key'       => 'meta_key_one',
     'value_of'  => 'meta_key_two',
     'compare'   => '>',
     'type'      => 'NUMERIC',
 ),
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42082#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list