diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 46a25274dd..63c3c844c1 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -2551,6 +2551,9 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) { do_action( 'edited_term_taxonomies', $edit_tt_ids ); } + // Get the term before deleting it or its term relationships so we can pass to actions below. + $deleted_term = get_term( $term, $taxonomy ); + $objects = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) ); foreach ( (array) $objects as $object ) { @@ -2571,9 +2574,6 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) { foreach ( $tax_object->object_type as $object_type ) clean_object_term_cache( $objects, $object_type ); - // Get the object before deletion so we can pass to actions below - $deleted_term = get_term( $term, $taxonomy ); - /** * Fires immediately before a term taxonomy ID is deleted. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 38f566bbfd..abb45f32e0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-33710'; +$wp_version = '4.4-alpha-33711'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.