mirror of
git://develop.git.wordpress.org/
synced 2025-02-27 10:02:43 +01:00
When reassigning posts and links during user deletion, clear the post and link caches. Props kurtpayne. fixes #20447
git-svn-id: https://develop.svn.wordpress.org/trunk@21798 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
fdc3e8caee
commit
fa5557c6d4
@ -270,8 +270,18 @@ function wp_delete_user( $id, $reassign = 'novalue' ) {
|
||||
}
|
||||
} else {
|
||||
$reassign = (int) $reassign;
|
||||
$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );
|
||||
$wpdb->update( $wpdb->posts, array('post_author' => $reassign), array('post_author' => $id) );
|
||||
if ( ! empty( $post_ids ) ) {
|
||||
foreach ( $post_ids as $post_id )
|
||||
clean_post_cache( $post_id );
|
||||
}
|
||||
$link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) );
|
||||
$wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) );
|
||||
if ( ! empty( $link_ids ) ) {
|
||||
foreach ( $link_ids as $link_id )
|
||||
clean_bookmark_cache( $link_id );
|
||||
}
|
||||
}
|
||||
|
||||
// FINALLY, delete user
|
||||
|
Loading…
x
Reference in New Issue
Block a user