WordPress.org

Make WordPress Core

Ticket #25545: Invalidate_post_cache_when_a_user_is_removed.patch

File Invalidate_post_cache_when_a_user_is_removed.patch, 859 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
     
    258258
    259259        if ( $reassign != '' ) {
    260260                $reassign = (int) $reassign;
     261
     262                // get posts by user to invalidate cache
     263                $posts = get_posts( array( 'author' => $user_id, 'numberposts' => -1 ) );
     264                foreach( $posts as $post ) {
     265                        clean_post_cache( $post );
     266                }
     267
    261268                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id) );
    262269                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id) );
    263270        }