Ticket #6860: clean_post_cache_recursive.patch
| File clean_post_cache_recursive.patch, 0.8 kB (added by arnee, 7 months ago) |
|---|
-
post.php
old new 2691 2691 * @uses do_action() Will call the 'clean_post_cache' hook action. 2692 2692 * 2693 2693 * @param int $id The Post ID in the cache to clean 2694 * @param bool $recursive Also clean the cache for child posts 2694 2695 */ 2695 function clean_post_cache($id ) {2696 function clean_post_cache($id, $recursive = true) { 2696 2697 global $wpdb; 2697 2698 $id = (int) $id; 2698 2699 … … 2705 2706 2706 2707 do_action('clean_post_cache', $id); 2707 2708 2708 if ( $children = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d", $id) ) ) {2709 if ($recursive && $children = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d", $id) ) ) { 2709 2710 foreach( $children as $cid ) 2710 2711 clean_post_cache( $cid ); 2711 2712 }
