Make WordPress Core

Ticket #31045: meta.php.patch

File meta.php.patch, 757 bytes (added by Funkatronic, 10 years ago)

Patch 1 checks for and applies user defined alias in meta query in joins

  • meta.php

     
    13511351                // We prefer to avoid joins if possible. Look for an existing join compatible with this clause.
    13521352                $alias = $this->find_compatible_table_alias( $clause, $parent_query );
    13531353                if ( false === $alias ) {
    1354                         $i = count( $this->table_aliases );
    1355                         $alias = $i ? 'mt' . $i : $this->meta_table;
     1354                        if( empty( $parent_query['alias'] ) ){
     1355                                $i = count( $this->table_aliases );
     1356                                $alias = $i ? 'mt' . $i : $this->meta_table;
     1357                        } else {
     1358                                $alias = $parent_query['alias'];       
     1359                        }
    13561360
    13571361                        // JOIN clauses for NOT EXISTS have their own syntax.
    13581362                        if ( 'NOT EXISTS' === $meta_compare ) {