Changeset 29945
- Timestamp:
- 10/17/2014 08:58:48 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r29931 r29945 2415 2415 $parent = $term_obj->parent; 2416 2416 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' ); 2418 2419 2419 2420 /** … … 2426 2427 do_action( 'edit_term_taxonomies', $edit_tt_ids ); 2427 2428 $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 ); 2428 2433 2429 2434 /** -
trunk/tests/phpunit/tests/term.php
r29875 r29945 1008 1008 1009 1009 /** 1010 * @ticket 29911 1011 */ 1012 public function test_wp_delete_term_should_invalidate_cache_for_child_terms() { 1013 register_taxonomy( 'wptests_tax', 'post', array( 1014 'hierarchical' => true, 1015 ) ); 1016 1017 $parent = $this->factory->term->create( array( 1018 'taxonomy' => 'wptests_tax', 1019 ) ); 1020 1021 $child = $this->factory->term->create( array( 1022 'taxonomy' => 'wptests_tax', 1023 'parent' => $parent, 1024 'slug' => 'foo', 1025 ) ); 1026 1027 // Prime the cache. 1028 $child_term = get_term( $child, 'wptests_tax' ); 1029 $this->assertSame( $parent, $child_term->parent ); 1030 1031 wp_delete_term( $parent, 'wptests_tax' ); 1032 $child_term = get_term( $child, 'wptests_tax' ); 1033 $this->assertSame( 0, $child_term->parent ); 1034 } 1035 1036 /** 1010 1037 * @ticket 5381 1011 1038 */
Note: See TracChangeset
for help on using the changeset viewer.