WordPress.org

Make WordPress Core

Ticket #25545: invalidate_post_cache.patch

File invalidate_post_cache.patch, 923 bytes (added by nprasath002, 6 years ago)
  • wordpressdotorg/wp-includes/ms-functions.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    260260                $reassign = (int) $reassign;
    261261                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id) );
    262262                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id) );
     263
     264                $number_of_posts = 1000;
     265                $paged = 0;
     266                while( $posts = get_posts( array( 'author' => $reassign, 'posts_per_page' => $number_of_posts, 'paged' => $paged ) ) ) {
     267                        foreach( $posts as $post) {
     268                                clean_post_cache( $post );
     269                        }
     270                        $paged++;
     271                }
    263272        }
    264273
    265274        restore_current_blog();