mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
Networks and Sites: Ensure the site ID in wp_insert_site() is still correct after calling clean_blog_cache().
By saving `$wpdb->insert_id` to a variable, we make sure the ID does not change if another database insert is performed on the `clean_site_cache` action. Props trepmal. Fixes #50324. git-svn-id: https://develop.svn.wordpress.org/trunk@47932 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -69,9 +69,11 @@ function wp_insert_site( array $data ) {
|
||||
return new WP_Error( 'db_insert_error', __( 'Could not insert site into the database.' ), $wpdb->last_error );
|
||||
}
|
||||
|
||||
clean_blog_cache( $wpdb->insert_id );
|
||||
$site_id = (int) $wpdb->insert_id;
|
||||
|
||||
$new_site = get_site( $wpdb->insert_id );
|
||||
clean_blog_cache( $site_id );
|
||||
|
||||
$new_site = get_site( $site_id );
|
||||
|
||||
if ( ! $new_site ) {
|
||||
return new WP_Error( 'get_site_error', __( 'Could not retrieve site data.' ) );
|
||||
|
||||
Reference in New Issue
Block a user