Changeset 17699 for trunk/wp-includes/query.php
- Timestamp:
- 04/25/2011 05:27:35 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r17689 r17699 848 848 */ 849 849 var $tax_query; 850 851 /** 852 * Metadata query container 853 * 854 * @since 3.2 855 * @access public 856 * @var object WP_Meta_Query 857 */ 858 var $meta_query = false; 850 859 851 860 /** … … 1526 1535 unset( $tax_query ); 1527 1536 1528 _parse_meta_query( $qv );1529 1530 1537 if ( empty($qv['author']) || ($qv['author'] == '0') ) { 1531 1538 $this->is_author = false; … … 1901 1908 $q = $this->fill_query_vars($q); 1902 1909 1910 // Parse meta query 1911 $this->meta_query = new WP_Meta_Query(); 1912 $this->meta_query->parse_query_vars( $q ); 1913 1903 1914 // Set a flag if a pre_get_posts hook changed the query vars. 1904 1915 $hash = md5( serialize( $this->query_vars ) ); … … 2236 2247 } 2237 2248 2238 if ( !empty( $this->tax_query->queries ) || !empty( $ q['meta_key']) ) {2249 if ( !empty( $this->tax_query->queries ) || !empty( $this->meta_query->queries ) ) { 2239 2250 $groupby = "{$wpdb->posts}.ID"; 2240 2251 } … … 2469 2480 } 2470 2481 2471 // Parse the meta query again if query vars have changed. 2472 if ( $this->query_vars_changed ) { 2473 $meta_query_hash = md5( serialize( $q['meta_query'] ) ); 2474 $_meta_query = $q['meta_query']; 2475 unset( $q['meta_query'] ); 2476 _parse_meta_query( $q ); 2477 if ( md5( serialize( $q['meta_query'] ) ) != $meta_query_hash && is_array( $_meta_query ) ) 2478 $q['meta_query'] = array_merge( $_meta_query, $q['meta_query'] ); 2479 } 2480 2481 if ( !empty( $q['meta_query'] ) ) { 2482 $clauses = call_user_func_array( '_get_meta_sql', array( $q['meta_query'], 'post', $wpdb->posts, 'ID', &$this) ); 2482 if ( !empty( $this->meta_query->queries ) ) { 2483 $clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this ); 2483 2484 $join .= $clauses['join']; 2484 2485 $where .= $clauses['where'];
Note: See TracChangeset
for help on using the changeset viewer.