Changeset 15765
- Timestamp:
- 10/09/2010 10:19:15 AM (15 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/canonical.php
r15707 r15765 147 147 148 148 $term_count = 0; 149 foreach ( $wp_query-> tax_queryas $tax_query )149 foreach ( $wp_query->get('tax_query') as $tax_query ) 150 150 $term_count += count( $tax_query['terms'] ); 151 151 -
trunk/wp-includes/classes.php
r15756 r15765 565 565 566 566 /* 567 * List of taxonomy queries568 *569 * A query is an associative array:570 * - 'taxonomy' string|array The taxonomy being queried571 * - 'terms' string|array The list of terms572 * - 'field' string (optional) Which term field is being used.573 * Possible values: 'term_id', 'slug' or 'name'574 * Default: 'slug'575 * - 'operator' string (optional)576 * Possible values: 'IN' and 'NOT IN'.577 * Default: 'IN'578 * - 'include_children' bool (optional) Whether to include child terms.579 * Default: true580 *581 * @since 3.1.0582 * @access public583 * @var array584 */585 var $tax_query = array();586 587 /*588 567 * Populates the $meta_query property 589 568 * … … 695 674 * @since 3.1.0 696 675 * 697 * @uses $this->tax_query 676 * @param array $tax_query List of taxonomy queries. A single taxonomy query is an associative array: 677 * - 'taxonomy' string|array The taxonomy being queried 678 * - 'terms' string|array The list of terms 679 * - 'field' string (optional) Which term field is being used. 680 * Possible values: 'term_id', 'slug' or 'name' 681 * Default: 'slug' 682 * - 'operator' string (optional) 683 * Possible values: 'IN' and 'NOT IN'. 684 * Default: 'IN' 685 * - 'include_children' bool (optional) Whether to include child terms. 686 * Default: true 698 687 * 699 688 * @param string $object_id_column 700 689 * @return string 701 690 */ 702 function get_tax_sql( $ object_id_column ) {691 function get_tax_sql( $tax_query, $object_id_column ) { 703 692 global $wpdb; 704 693 705 694 $sql = array(); 706 foreach ( $t his->tax_query as $query ) {695 foreach ( $tax_query as $query ) { 707 696 if ( !isset( $query['include_children'] ) ) 708 697 $query['include_children'] = true; -
trunk/wp-includes/query.php
r15752 r15765 1082 1082 unset($this->query); 1083 1083 $this->query_vars = array(); 1084 $this->tax_query = array();1085 1084 $this->meta_query = array(); 1086 1085 unset($this->queried_object); … … 1400 1399 } 1401 1400 1402 function parse_tax_query( $q ) { 1401 /* 1402 * Populates the 'tax_query' property 1403 * 1404 * @access protected 1405 * @since 3.1.0 1406 * 1407 * @param array &$q The query variables 1408 */ 1409 function parse_tax_query( &$q ) { 1403 1410 if ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) { 1404 1411 $tax_query = $q['tax_query']; … … 1503 1510 } 1504 1511 1505 $ this->tax_query= $tax_query;1506 1507 foreach ( $ this->tax_queryas $query ) {1512 $q['tax_query'] = $tax_query; 1513 1514 foreach ( $q['tax_query'] as $query ) { 1508 1515 if ( 'IN' == $query['operator'] ) { 1509 1516 switch ( $query['taxonomy'] ) { … … 1846 1853 1847 1854 // Taxonomies 1848 if ( !empty( $ this->tax_query) ) {1855 if ( !empty( $q['tax_query'] ) ) { 1849 1856 if ( empty($post_type) ) { 1850 1857 $post_type = 'any'; … … 1854 1861 } 1855 1862 1856 $where .= $this->get_tax_sql( "$wpdb->posts.ID" );1863 $where .= $this->get_tax_sql( $q['tax_query'], "$wpdb->posts.ID" ); 1857 1864 1858 1865 // Back-compat 1859 1866 if ( !empty( $ids ) ) { 1860 $cat_query = wp_list_filter( $ this->tax_query, array( 'taxonomy' => 'category' ) );1867 $cat_query = wp_list_filter( $q['tax_query'], array( 'taxonomy' => 'category' ) ); 1861 1868 if ( !empty( $cat_query ) ) { 1862 1869 $cat_query = reset( $cat_query ); … … 2515 2522 $this->queried_object_id = 0; 2516 2523 2517 if ( $this->tax_query ) { 2518 $query = reset( $this->tax_query ); 2519 if ( 'term_id' == $query['field'] ) 2524 $tax_query = $this->get('tax_query'); 2525 2526 if ( !empty( $tax_query ) ) { 2527 $query = reset( $tax_query ); 2528 if ( 'term_id' == $query['field'] ) 2520 2529 $term = get_term( reset( $query['terms'] ), $query['taxonomy'] ); 2521 2530 else
Note: See TracChangeset
for help on using the changeset viewer.