diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php index e7695db4a4..e701656535 100644 --- a/wp-includes/ms-blogs.php +++ b/wp-includes/ms-blogs.php @@ -235,10 +235,14 @@ function get_blog_details( $fields = null, $get_all = true ) { * * @since MU * - * @param int $blog_id Blog ID + * @param int $blog_id Optional. Blog ID. Defaults to current blog. */ -function refresh_blog_details( $blog_id ) { +function refresh_blog_details( $blog_id = 0 ) { $blog_id = (int) $blog_id; + if ( ! $blog_id ) { + $blog_id = get_current_blog_id(); + } + $details = get_blog_details( $blog_id, false ); if ( ! $details ) { // Make sure clean_blog_cache() gets the blog ID @@ -263,19 +267,6 @@ function refresh_blog_details( $blog_id ) { do_action( 'refresh_blog_details', $blog_id ); } -/** - * Refresh blog details when an option is updated. - * - * @access private - * @param string $option_name - */ -function _wp_refresh_blog_details_on_updated_option( $option_name ) { - $options = array( 'blogname', 'siteurl', 'post_count' ); - if ( in_array( $option_name, $options ) ) { - refresh_blog_details( get_current_blog_id() ); - } -} - /** * Update the details for a blog. Updates the blogs table for a given blog id. * diff --git a/wp-includes/ms-default-filters.php b/wp-includes/ms-default-filters.php index 3b22b87e1b..7481ec9a02 100644 --- a/wp-includes/ms-default-filters.php +++ b/wp-includes/ms-default-filters.php @@ -71,7 +71,9 @@ remove_filter( 'option_siteurl', '_config_wp_siteurl' ); remove_filter( 'option_home', '_config_wp_home' ); // Some options changes should trigger blog details refresh. -add_action( 'updated_option', '_wp_refresh_blog_details_on_updated_option' ); +add_action( 'update_option_blogname', 'refresh_blog_details', 10, 0 ); +add_action( 'update_option_siteurl', 'refresh_blog_details', 10, 0 ); +add_action( 'update_option_post_count', 'refresh_blog_details', 10, 0 ); // If the network upgrade hasn't run yet, assume ms-files.php rewriting is used. add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );