Fire the update_blog_public action from update_blog_status() instead of update_blog_public(). Pass blog ID and value to the action.
Add code to noindex() to sync the 'public' value in the site options table with the blog_public value in the options table. fixes #23155 git-svn-id: https://develop.svn.wordpress.org/trunk@23794 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e9746944fa
commit
315f606306
|
@ -1703,8 +1703,22 @@ function wlwmanifest_link() {
|
|||
* @since 2.1.0
|
||||
*/
|
||||
function noindex() {
|
||||
$public = get_option( 'blog_public' );
|
||||
|
||||
if ( is_multisite() ) {
|
||||
// Compare local and global and override with the local setting if they
|
||||
// don't match.
|
||||
|
||||
global $current_blog;
|
||||
|
||||
if ( ( '' != $public ) && ( $public != $current_blog->public ) ) {
|
||||
update_blog_status( get_current_blog_id(), 'public', $public );
|
||||
$current_blog->public = $public;
|
||||
}
|
||||
}
|
||||
|
||||
// If the blog is not public, tell robots to go away.
|
||||
if ( '0' == get_option('blog_public') )
|
||||
if ( '0' == $public )
|
||||
wp_no_robots();
|
||||
}
|
||||
|
||||
|
|
|
@ -695,6 +695,8 @@ function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) {
|
|||
( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id );
|
||||
elseif ( 'deleted' == $pref )
|
||||
( $value == 1 ) ? do_action( 'make_delete_blog', $blog_id ) : do_action( 'make_undelete_blog', $blog_id );
|
||||
elseif ( 'public' == $pref )
|
||||
do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public().
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
|
|
@ -1734,9 +1734,7 @@ function is_user_spammy( $user_login = null ) {
|
|||
* @return bool
|
||||
*/
|
||||
function update_blog_public( $old_value, $value ) {
|
||||
global $wpdb;
|
||||
do_action('update_blog_public');
|
||||
update_blog_status( $wpdb->blogid, 'public', (int) $value );
|
||||
update_blog_status( get_current_blog_id(), 'public', (int) $value );
|
||||
}
|
||||
add_action('update_option_blog_public', 'update_blog_public', 10, 2);
|
||||
|
||||
|
|
Loading…
Reference in New Issue