Make WordPress Core

Ticket #41266: 41266-approach-1.diff

File 41266-approach-1.diff, 1.3 KB (added by andizer, 8 years ago)
  • src/wp-includes/class-wp-meta-query.php

    diff --git src/wp-includes/class-wp-meta-query.php src/wp-includes/class-wp-meta-query.php
    index 3fb7956da..c848dd8cb 100644
    class WP_Meta_Query { 
    9595        protected $has_or_relation = false;
    9696
    9797        /**
     98         * The default meta table alias.
     99         *
     100         * @var string
     101         */
     102        protected $default_meta_table_alias = 'mt';
     103
     104        /**
    98105         * Constructor.
    99106         *
    100107         * @since 3.2.0
    class WP_Meta_Query { 
    511518                $alias = $this->find_compatible_table_alias( $clause, $parent_query );
    512519                if ( false === $alias ) {
    513520                        $i = count( $this->table_aliases );
    514                         $alias = $i ? 'mt' . $i : $this->meta_table;
     521                        $alias = $i ? $this->default_meta_table_alias . $i : $this->meta_table;
    515522
    516523                        // JOIN clauses for NOT EXISTS have their own syntax.
    517524                        if ( 'NOT EXISTS' === $meta_compare ) {
    class WP_Meta_Query { 
    727734        public function has_or_relation() {
    728735                return $this->has_or_relation;
    729736        }
     737
     738        /**
     739         * Sets default meta table alias.
     740         *
     741         * @param string $default_meta_table_alias The default meta table alias.
     742         *
     743         * @return void
     744         */
     745        public function set_default_meta_table_alias( $default_meta_table_alias ) {
     746                $this->default_meta_table_alias = $default_meta_table_alias;
     747        }
    730748}