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
This commit is contained in:
parent
7b0371676d
commit
fe9866dc79
|
@ -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