WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/17/2014 08:58:48 PM (7 years ago)
Author:
boonebgorges
Message:

Invalidate cache for child terms when parent term is deleted.

Props socki03.
Fixes #29911.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r29931 r29945  
    24152415        $parent = $term_obj->parent;
    24162416
    2417         $edit_tt_ids = $wpdb->get_col( "SELECT `term_taxonomy_id` FROM $wpdb->term_taxonomy WHERE `parent` = " . (int)$term_obj->term_id );
     2417        $edit_ids = $wpdb->get_results( "SELECT term_id, term_taxonomy_id FROM $wpdb->term_taxonomy WHERE `parent` = " . (int)$term_obj->term_id );
     2418        $edit_tt_ids = wp_list_pluck( $edit_ids, 'term_taxonomy_id' );
    24182419
    24192420        /**
     
    24262427        do_action( 'edit_term_taxonomies', $edit_tt_ids );
    24272428        $wpdb->update( $wpdb->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id) + compact( 'taxonomy' ) );
     2429
     2430        // Clean the cache for all child terms.
     2431        $edit_term_ids = wp_list_pluck( $edit_ids, 'term_id' );
     2432        clean_term_cache( $edit_term_ids, $taxonomy );
    24282433
    24292434        /**
Note: See TracChangeset for help on using the changeset viewer.