Make WordPress Core


Ignore:
Timestamp:
10/19/2014 06:53:55 PM (11 years ago)
Author:
boonebgorges
Message:

Make orderby=meta_value compatible with meta_query when relation=OR.

Passing orderby=meta_value and meta_key=foo to WP_Query should require that
each matched post have a meta value with the key 'foo'. To make this
requirement compatible with meta_query params that have the relation OR, we
nest the meta_query param, and join it using AND to a meta_query clause
generated from the meta_key/meta_compare/meta_type query vars.

Fixes #25538.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/meta/query.php

    r29940 r29964  
    105105
    106106        $expected1 = array(
    107             'key' => 'foo1',
    108             'compare' => 'baz1',
    109             'value' => 'bar1',
     107            'relation' => 'OR',
     108            array(
     109                'key' => 'foo1',
     110                'compare' => 'baz1',
     111                'value' => 'bar1',
     112            ),
    110113        );
    111114        $this->assertEquals( $expected1, $query->queries[1] );
Note: See TracChangeset for help on using the changeset viewer.