In multisite, on the `updated_option` action, if the option name is one of: 'blogname', 'siteurl', 'post_count' - refresh the blog details cache for the current blog id.
Adds unit test. Props kovshenin. Fixes #26410. Built from https://develop.svn.wordpress.org/trunk@28881 git-svn-id: http://core.svn.wordpress.org/trunk@28680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
13d0a45932
commit
2e81419d4c
|
@ -263,6 +263,19 @@ function refresh_blog_details( $blog_id ) {
|
||||||
do_action( '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.
|
* Update the details for a blog. Updates the blogs table for a given blog id.
|
||||||
*
|
*
|
||||||
|
|
|
@ -70,6 +70,9 @@ add_filter( 'force_filtered_html_on_import', '__return_true' );
|
||||||
remove_filter( 'option_siteurl', '_config_wp_siteurl' );
|
remove_filter( 'option_siteurl', '_config_wp_siteurl' );
|
||||||
remove_filter( 'option_home', '_config_wp_home' );
|
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' );
|
||||||
|
|
||||||
// If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
|
// 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' );
|
add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue