if ( $post_ids ) { foreach ( $post_ids as $post_id ) { wp_delete_post( $post_id );
} } // Clean links.
$link_ids =
$wpdb->
get_col( $wpdb->
prepare( "SELECT link_id FROM
$wpdb->links WHERE link_owner = %d",
$id ) );
if ( $link_ids ) { foreach ( $link_ids as $link_id ) { wp_delete_link( $link_id );
} } } else { $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 ) );