[wp-trac] [WordPress Trac] #25538: WP_Query: OR relation breaks orderby meta_value

WordPress Trac noreply at wordpress.org
Wed Jun 4 18:18:39 UTC 2014

#25538: WP_Query: OR relation breaks orderby meta_value
 Reporter:  darrengrant          |       Owner:  wonderboymusic
     Type:  defect (bug)         |      Status:  reopened
 Priority:  normal               |   Milestone:  4.0
Component:  Query                |     Version:
 Severity:  major                |  Resolution:
 Keywords:  has-patch 4.0-early  |     Focuses:
Changes (by boonebgorges):

 * status:  closed => reopened
 * resolution:  fixed =>


 This change broke some functionality in BuddyPress. For an admittedly lame
 reason, we perform some regular expressions and string manipulation on the
 SQL generated by `WP_Meta_Query`. r28659 changes the format of the `WHERE`
 clauses, by not wrapping each individual one in parentheses, eg

 AND wp_postmeta.meta_key = 'foo'

 instead of
 AND (wp_postmeta.meta_key = 'foo' )

 So we can no longer rely on the parentheses as reliable markers of the
 individual clauses.

 I know that this request is totally lame, but perhaps for consistency's
 sake, you could adopt the same punctuation for the `$where_meta_key`
 clause as for the old `$where`. See 25538.parens.patch. (I've kept the
 idiosyncratic spacing, but that's not important.)

Ticket URL: <https://core.trac.wordpress.org/ticket/25538#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list