From 9fd39dd04501b344d33e7bbf296669f892353f83 Mon Sep 17 00:00:00 2001 From: Brandon Kraft Date: Thu, 2 May 2019 17:37:00 -0500 Subject: [PATCH] Use WP 5.1-era hook --- class.jetpack-network.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/class.jetpack-network.php b/class.jetpack-network.php index bf6b6d38933fc..036e6e5049b89 100644 --- a/class.jetpack-network.php +++ b/class.jetpack-network.php @@ -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' ) ); } } @@ -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 ); + } } /**