From fe9866dc795f441761f5c9f54a9da8ff9c9d22ff Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 17 Jul 2008 16:59:40 +0000 Subject: [PATCH] Fix is_term query prepare() so that tag slugs that percent signs in them don't break. fixes #6867 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@8363 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 45391454f5..8ed744cd07 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -764,17 +764,17 @@ function is_term($term, $taxonomy = '') { if ( is_int($term) ) { if ( 0 == $term ) return 0; - $where = $wpdb->prepare( "t.term_id = %d", $term ); + $where = 't.term_id = %d'; } else { if ( '' === $term = sanitize_title($term) ) return 0; - $where = $wpdb->prepare( "t.slug = %s", $term ); + $where = 't.slug = %s'; } if ( !empty($taxonomy) ) - 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); + 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); - return $wpdb->get_var("SELECT term_id FROM $wpdb->terms as t WHERE $where"); + return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $term) ); } /**