WordPress.org

Make WordPress Core

Ticket #17235: 17235.2.diff

File 17235.2.diff, 1.0 KB (added by wonderboymusic, 5 years ago)
  • wp-includes/meta.php

    diff --git a/wp-includes/meta.php b/wp-includes/meta.php
    index 22b0315..14fe546 100644
    a b class WP_Meta_Query { 
    652652
    653653                $this->queries = array();
    654654
    655                 foreach ( $meta_query as $key => $query ) {
     655                // Single meta queries shouldn't need to pass an array of arrays
     656                if ( isset( $meta_query['key'] ) || isset( $meta_query['value'] ) )
     657                        $meta_query = array( $meta_query );
     658               
     659                foreach ( $meta_query as $query ) {
    656660                        if ( ! is_array( $query ) )
    657661                                continue;
    658662
  • wp-includes/taxonomy.php

    diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
    index 955369e..3ff1771 100644
    a b class WP_Tax_Query { 
    645645                        'operator' => 'IN',
    646646                );
    647647
     648                // Single tax queries shouldn't need to pass an array of arrays
     649                if ( isset( $tax_query['taxonomy'] ) && isset( $tax_query['terms'] ) )
     650                        $tax_query = array( $tax_query );
     651
    648652                foreach ( $tax_query as $query ) {
    649653                        if ( ! is_array( $query ) )
    650654                                continue;