Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multisite: Use WP 5.1-era hook wp_initialize_site #12252

Merged
merged 1 commit into from
May 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions class.jetpack-network.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ private function __construct() {
/*
* If admin wants to automagically register new sites set the hook here
*
* This is a hacky way because xmlrpc is not available on wpmu_new_blog
* This is a hacky way because xmlrpc is not available on wp_initialize_site
*/
if ( $this->get_option( 'auto-connect' ) == 1 ) {
add_action( 'wpmu_new_blog', array( $this, 'do_automatically_add_new_site' ) );
add_action( 'wp_initialize_site', array( $this, 'do_automatically_add_new_site' ) );
}
}

Expand Down Expand Up @@ -107,12 +107,15 @@ public function set_auto_activated_modules( $modules ) {
* Registers new sites upon creation
*
* @since 2.9
* @uses wpmu_new_blog
* @since 7.4.0 Uses a WP_Site object.
* @uses wp_initialize_site
*
* @param int $blog_id
* @param WP_Site $site
**/
public function do_automatically_add_new_site( $blog_id ) {
$this->do_subsiteregister( $blog_id );
public function do_automatically_add_new_site( $site ) {
if ( is_a( $site, 'WP_Site') ) {
$this->do_subsiteregister( $site->id );
}
}

/**
Expand Down