From 57fca2acf3f4f94ebd2e4ab1b9b005e67182e1f0 Mon Sep 17 00:00:00 2001 From: westi Date: Thu, 2 Dec 2010 17:10:02 +0000 Subject: [PATCH] Clean the cache when deleting a term. Fixes #15651 git-svn-id: http://svn.automattic.com/wordpress/trunk@16691 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 5f9eb6d44..59f162a19 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1604,6 +1604,11 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) { 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 ); $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $tt_id ) ); do_action( 'deleted_term_taxonomy', $tt_id );