WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4/src/wp-includes/taxonomy.php

    r35725 r36109  
    391391            $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] );
    392392        $wp->add_query_var( $args['query_var'] );
     393    } else {
     394        // Force query_var to false for non-public taxonomies.
     395        $args['query_var'] = false;
    393396    }
    394397
     
    13541357    // Meta query support.
    13551358    $join = '';
     1359    $distinct = '';
    13561360    if ( ! empty( $args['meta_query'] ) ) {
    13571361        $mquery = new WP_Meta_Query( $args['meta_query'] );
     
    13601364        $join  .= $mq_sql['join'];
    13611365        $where .= $mq_sql['where'];
     1366        $distinct .= "DISTINCT";
    13621367    }
    13631368
     
    14091414    $join .= " INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id";
    14101415
    1411     $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' );
     1416    $pieces = array( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' );
    14121417
    14131418    /**
     
    14251430    $join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
    14261431    $where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
     1432    $distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
    14271433    $orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
    14281434    $order = isset( $clauses[ 'order' ] ) ? $clauses[ 'order' ] : '';
    14291435    $limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
    14301436
    1431     $query = "SELECT $fields FROM $wpdb->terms AS t $join WHERE $where $orderby $order $limits";
     1437    $query = "SELECT $distinct $fields FROM $wpdb->terms AS t $join WHERE $where $orderby $order $limits";
    14321438
    14331439    // $args can be anything. Only use the args defined in defaults to compute the key.
     
    36053611    $terms = wp_get_object_terms( $ids, $taxonomies, array(
    36063612        'fields' => 'all_with_object_id',
    3607         'orderby' => 'none',
     3613        'orderby' => 'name',
    36083614        'update_term_meta_cache' => false,
    36093615    ) );
Note: See TracChangeset for help on using the changeset viewer.