WordPress.org

Make WordPress Core

Changeset 8364


Ignore:
Timestamp:
07/17/2008 05:00:35 PM (10 years ago)
Author:
ryan
Message:

Fix is_term query prepare() so that tag slugs that have percent signs in them don't break. fixes #6867 for 2.6

File:
1 edited

Legend:

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

    r8225 r8364  
    765765        if ( 0 == $term )
    766766            return 0;
    767         $where = $wpdb->prepare( "t.term_id = %d", $term );
     767        $where = 't.term_id = %d';
    768768    } else {
    769769        if ( '' === $term = sanitize_title($term) )
    770770            return 0;
    771         $where = $wpdb->prepare( "t.slug = %s", $term );
     771        $where = 't.slug = %s';
    772772    }
    773773
    774774    if ( !empty($taxonomy) )
    775         return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $taxonomy), ARRAY_A);
    776 
    777     return $wpdb->get_var("SELECT term_id FROM $wpdb->terms as t WHERE $where");
     775        return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A);
     776
     777    return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $term) );
    778778}
    779779
Note: See TracChangeset for help on using the changeset viewer.