Introduce $wpdb->delete(). props justindgivens, scribu. fixes #18948.

git-svn-id: https://develop.svn.wordpress.org/trunk@20287 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2012-03-24 15:24:31 +00:00
parent 2a020b2d93
commit 54a6a40533
11 changed files with 72 additions and 25 deletions
+2 -2
View File
@@ -1802,12 +1802,12 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
clean_object_term_cache( $objects, $object_type );
do_action( 'delete_term_taxonomy', $tt_id );
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $tt_id ) );
$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) );
do_action( 'deleted_term_taxonomy', $tt_id );
// Delete the term if no taxonomies use it.
if ( !$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term) ) )
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->terms WHERE term_id = %d", $term) );
$wpdb->delete( $wpdb->terms, array( 'term_id' => $term ) );
clean_term_cache($term, $taxonomy);