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. Built from https://develop.svn.wordpress.org/trunk@47932 git-svn-id: http://core.svn.wordpress.org/trunk@47705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
40584118d9
commit
bbdfffdaa1
|
@ -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.' ) );
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-47930';
|
||||
$wp_version = '5.5-alpha-47932';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue