Make WordPress Core


Ignore:
Timestamp:
06/09/2020 12:39:09 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-site.php

    r47611 r47932  
    7070    }
    7171
    72     clean_blog_cache( $wpdb->insert_id );
    73 
    74     $new_site = get_site( $wpdb->insert_id );
     72    $site_id = (int) $wpdb->insert_id;
     73
     74    clean_blog_cache( $site_id );
     75
     76    $new_site = get_site( $site_id );
    7577
    7678    if ( ! $new_site ) {
Note: See TracChangeset for help on using the changeset viewer.