wp/wp-includes/class-wp-meta-query.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
   558 			if ( 'NOT EXISTS' === $meta_compare ) {
   558 			if ( 'NOT EXISTS' === $meta_compare ) {
   559 				$join .= " LEFT JOIN $this->meta_table";
   559 				$join .= " LEFT JOIN $this->meta_table";
   560 				$join .= $i ? " AS $alias" : '';
   560 				$join .= $i ? " AS $alias" : '';
   561 
   561 
   562 				if ( 'LIKE' === $meta_compare_key ) {
   562 				if ( 'LIKE' === $meta_compare_key ) {
   563 					$join .= $wpdb->prepare( " ON ($this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key LIKE %s )", '%' . $wpdb->esc_like( $clause['key'] ) . '%' );
   563 					$join .= $wpdb->prepare( " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key LIKE %s )", '%' . $wpdb->esc_like( $clause['key'] ) . '%' );
   564 				} else {
   564 				} else {
   565 					$join .= $wpdb->prepare( " ON ($this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key = %s )", $clause['key'] );
   565 					$join .= $wpdb->prepare( " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key = %s )", $clause['key'] );
   566 				}
   566 				}
   567 
   567 
   568 				// All other JOIN clauses.
   568 				// All other JOIN clauses.
   569 			} else {
   569 			} else {
   570 				$join .= " INNER JOIN $this->meta_table";
   570 				$join .= " INNER JOIN $this->meta_table";
   820 		/**
   820 		/**
   821 		 * Filters the table alias identified as compatible with the current clause.
   821 		 * Filters the table alias identified as compatible with the current clause.
   822 		 *
   822 		 *
   823 		 * @since 4.1.0
   823 		 * @since 4.1.0
   824 		 *
   824 		 *
   825 		 * @param string|bool   $alias        Table alias, or false if none was found.
   825 		 * @param string|false  $alias        Table alias, or false if none was found.
   826 		 * @param array         $clause       First-order query clause.
   826 		 * @param array         $clause       First-order query clause.
   827 		 * @param array         $parent_query Parent of $clause.
   827 		 * @param array         $parent_query Parent of $clause.
   828 		 * @param WP_Meta_Query $this         WP_Meta_Query object.
   828 		 * @param WP_Meta_Query $this         WP_Meta_Query object.
   829 		 */
   829 		 */
   830 		return apply_filters( 'meta_query_find_compatible_table_alias', $alias, $clause, $parent_query, $this );
   830 		return apply_filters( 'meta_query_find_compatible_table_alias', $alias, $clause, $parent_query, $this );