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

git-svn-id: https://develop.svn.wordpress.org/trunk@8363 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-07-17 16:59:40 +00:00
parent fe985f8b12
commit a118de6487
1 changed files with 4 additions and 4 deletions

View File

@ -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) );
}
/**