WordPress.org

Make WordPress Core

Ticket #27881: get-terms-27881.diff

File get-terms-27881.diff, 1000 bytes (added by wonderboymusic, 7 years ago)
  • src/wp-includes/taxonomy.php

     
    15401540         * @param array        $args       An array of terms query arguments.
    15411541         */
    15421542        $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args );
    1543         foreach ( $pieces as $piece )
    1544                 $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : '';
    15451543
    1546         $query = "SELECT $fields FROM $wpdb->terms AS t $join WHERE $where $orderby $order $limits";
     1544        $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
     1545        $join = isset( $clauses['join'] ) ? $clauses['join'] : '';
    15471546
     1547        $query = "SELECT $fields FROM $wpdb->terms AS t $join WHERE";
     1548        foreach ( array( 'where', 'orderby', 'order', 'limits' ) as $piece ) {
     1549                if ( isset( $clauses[ $piece ] ) ) {
     1550                        $query .= ' ' . $clauses[ $piece ];
     1551                }
     1552        }
     1553
    15481554        $fields = $_fields;
    15491555
    15501556        if ( 'count' == $fields ) {