WordPress.org

Make WordPress Core

Changeset 29953


Ignore:
Timestamp:
10/18/2014 02:21:33 AM (7 years ago)
Author:
boonebgorges
Message:

Remove redundant table alias check in WP_Meta_Query.

Also adds documentation for 'meta_query_find_compatible_table_alias' filter.

See #24093.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/meta.php

    r29941 r29953  
    13321332                $join .= $i ? " AS $alias" : '';
    13331333                $join .= $wpdb->prepare( " ON ($this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key = %s )", $clause['key'] );
    1334                 $sql_chunks['join'][] = $join;
    13351334
    13361335            // All other JOIN clauses.
    13371336            } else {
    1338                 $alias = $this->find_compatible_table_alias( $clause, $parent_query );
    1339                 if ( false === $alias ) {
    1340                     $alias = $i ? 'mt' . $i : $this->meta_table;
    1341 
    1342                     $join .= " INNER JOIN $this->meta_table";
    1343                     $join .= $i ? " AS $alias" : '';
    1344                     $join .= " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column )";
    1345                 }
     1337                $join .= " INNER JOIN $this->meta_table";
     1338                $join .= $i ? " AS $alias" : '';
     1339                $join .= " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column )";
    13461340            }
    13471341
     
    14701464        }
    14711465
     1466        /**
     1467         * Filter the table alias identified as compatible with the current clause.
     1468         *
     1469         * @since 4.1.0
     1470         *
     1471         * @param string|bool $alias        Table alias, or false if none was found.
     1472         * @param array       $clause       First-order query clause.
     1473         * @param array       $parent_query Parent of $clause.
     1474         * @param object      $this         WP_Meta_Query object.
     1475         */
    14721476        return apply_filters( 'meta_query_find_compatible_table_alias', $alias, $clause, $parent_query, $this ) ;
    14731477    }
Note: See TracChangeset for help on using the changeset viewer.