Delete term if no taxonomies use it. see #4189
git-svn-id: https://develop.svn.wordpress.org/trunk@5559 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6485c0e03f
commit
bbcffa4c56
@ -165,6 +165,10 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = '$tt_id'");
|
||||
|
||||
// Delete the term if no taxonomies use it.
|
||||
if ( !$wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = '$term'") )
|
||||
$wpdb->query("DELETE FROM $wpdb->terms WHERE term_id = '$term'");
|
||||
|
||||
clean_term_cache($term, $taxonomy);
|
||||
|
||||
do_action("delete_$taxonomy", $term, $tt_id);
|
||||
|
Loading…
Reference in New Issue
Block a user