Make WordPress Core

Ticket #21683: 21683.patch

File 21683.patch, 1.2 KB (added by sc0ttkclark, 12 years ago)

Oops! Wrong patch selected the first time :)

  • trunk/wp-includes/meta.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    636636        public $relation;
    637637
    638638        /**
     639         * The relation between the meta query and what it's pulled into. Can be one of 'AND' or 'OR'.
     640         *
     641         * @access public
     642         * @var string
     643         */
     644        public $query_relation;
     645
     646        /**
    639647         * Constructor
    640648         *
    641649         * @param array $meta_query (optional) A meta query
     
    650658                        $this->relation = 'AND';
    651659                }
    652660
     661                if ( isset( $meta_query[ 'query_relation' ] ) && strtoupper( $meta_query[ 'query_relation' ] ) == 'OR' ) {
     662                        $this->query_relation = 'OR';
     663                }
     664                else {
     665                        $this->query_relation = 'AND';
     666                }
     667
    653668                $this->queries = array();
    654669
    655670                foreach ( $meta_query as $key => $query ) {
     
    798813                if ( empty( $where ) )
    799814                        $where = '';
    800815                else
    801                         $where = ' AND (' . implode( "\n{$this->relation} ", $where ) . ' )';
     816                        $where = " {$this->query_relation} (" . implode( "\n{$this->relation} ", $where ) . ' )';
    802817
    803818                $join = implode( "\n", $join );
    804819                if ( ! empty( $join ) )