Clean the cache when deleting a term. Fixes #15651

git-svn-id: http://svn.automattic.com/wordpress/trunk@16691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2010-12-02 17:10:02 +00:00
parent 3b5707c4be
commit 57fca2acf3
1 changed files with 5 additions and 0 deletions

View File

@ -1604,6 +1604,11 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
wp_set_object_terms($object, $terms, $taxonomy); wp_set_object_terms($object, $terms, $taxonomy);
} }
// Clean the relationship caches for all object types using this term
$tax_object = get_taxonomy( $taxonomy );
foreach ( $tax_object->object_type as $object_type )
clean_object_term_cache( $objects, $object_type );
do_action( 'delete_term_taxonomy', $tt_id ); do_action( 'delete_term_taxonomy', $tt_id );
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $tt_id ) ); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $tt_id ) );
do_action( 'deleted_term_taxonomy', $tt_id ); do_action( 'deleted_term_taxonomy', $tt_id );