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:
parent
fe985f8b12
commit
a118de6487
|
@ -764,17 +764,17 @@ function is_term($term, $taxonomy = '') {
|
||||||
if ( is_int($term) ) {
|
if ( is_int($term) ) {
|
||||||
if ( 0 == $term )
|
if ( 0 == $term )
|
||||||
return 0;
|
return 0;
|
||||||
$where = $wpdb->prepare( "t.term_id = %d", $term );
|
$where = 't.term_id = %d';
|
||||||
} else {
|
} else {
|
||||||
if ( '' === $term = sanitize_title($term) )
|
if ( '' === $term = sanitize_title($term) )
|
||||||
return 0;
|
return 0;
|
||||||
$where = $wpdb->prepare( "t.slug = %s", $term );
|
$where = 't.slug = %s';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($taxonomy) )
|
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) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue