Make WordPress Core

Changeset 16845


Ignore:
Timestamp:
12/09/2010 05:19:23 PM (14 years ago)
Author:
scribu
Message:

False advertising is bad. See #15752

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r16843 r16845  
    512512 *
    513513 * @param array $tax_query List of taxonomy queries. A single taxonomy query is an associative array:
    514  * - 'taxonomy' string|array The taxonomy being queried
     514 * - 'taxonomy' string The taxonomy being queried
    515515 * - 'terms' string|array The list of terms
    516516 * - 'field' string (optional) Which term field is being used.
     
    548548        extract( $query );
    549549
    550         $taxonomies = (array) $taxonomy;
    551 
    552         foreach ( $taxonomies as $taxonomy ) {
    553             if ( ! taxonomy_exists( $taxonomy ) )
    554                 return array( 'join' => '', 'where' => ' AND 0 = 1');
    555         }
    556 
    557         $taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
     550        if ( ! taxonomy_exists( $taxonomy ) )
     551            return array( 'join' => '', 'where' => ' AND 0 = 1');
    558552
    559553        $terms = array_unique( (array) $terms );
     
    563557
    564558        if ( is_taxonomy_hierarchical( $taxonomy ) && $include_children ) {
    565             _transform_terms( $terms, $taxonomies, $field, 'term_id' );
     559            _transform_terms( $terms, $taxonomy, $field, 'term_id' );
    566560
    567561            $children = array();
     
    572566            $terms = $children;
    573567
    574             _transform_terms( $terms, $taxonomies, 'term_id', 'term_taxonomy_id' );
     568            _transform_terms( $terms, $taxonomy, 'term_id', 'term_taxonomy_id' );
    575569        }
    576570        else {
    577             _transform_terms( $terms, $taxonomies, $field, 'term_taxonomy_id' );
     571            _transform_terms( $terms, $taxonomy, $field, 'term_taxonomy_id' );
    578572        }
    579573
     
    627621
    628622    $defaults = array(
    629         'taxonomy' => array(),
     623        'taxonomy' => '',
    630624        'terms' => array(),
    631625        'include_children' => true,
     
    644638}
    645639
    646 function _transform_terms( &$terms, $taxonomies, $field, $resulting_field ) {
     640function _transform_terms( &$terms, $taxonomy, $field, $resulting_field ) {
    647641    global $wpdb;
    648642
     
    663657                FROM $wpdb->term_taxonomy
    664658                INNER JOIN $wpdb->terms USING (term_id)
    665                 WHERE taxonomy IN ($taxonomies)
     659                WHERE taxonomy = '$taxonomy'
    666660                AND $wpdb->terms.$field IN ($terms)
    667661            " );
     
    673667                SELECT $resulting_field
    674668                FROM $wpdb->term_taxonomy
    675                 WHERE taxonomy IN ($taxonomies)
     669                WHERE taxonomy = '$taxonomy'
    676670                AND term_id IN ($terms)
    677671            " );
Note: See TracChangeset for help on using the changeset viewer.