From bd28deacbd085caa4aed504c5d1cf4d97d0cfb13 Mon Sep 17 00:00:00 2001 From: Nathan Schmidt <91974372+nathan-schmidt-viget@users.noreply.github.com> Date: Mon, 11 Dec 2023 08:20:16 -0700 Subject: [PATCH] [#15] updating PR format --- .../goodbids/src/classes/network/Sites.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/client-mu-plugins/goodbids/src/classes/network/Sites.php b/client-mu-plugins/goodbids/src/classes/network/Sites.php index 4532d00b4..11b0ddf9c 100644 --- a/client-mu-plugins/goodbids/src/classes/network/Sites.php +++ b/client-mu-plugins/goodbids/src/classes/network/Sites.php @@ -41,7 +41,7 @@ public function __construct() { $this->save_edit_site_fields(); $this->new_site_form_fields(); $this->edit_site_form_fields(); - $this->activate_child_theme(); + $this->activate_child_theme_on_new_site(); } /** @@ -313,7 +313,7 @@ function ( WP_Site $new_site, array $args ) { */ private function save_edit_site_fields(): void { add_action( - 'wp_update_site', + 'wp_initialize_site', /** * @param WP_Site $new_site New site object. * @param WP_Site $old_site Old site object. @@ -352,23 +352,22 @@ function ( WP_Site $new_site, WP_Site $old_site ) { * * @since 1.0.0 * - * @param int $site_id Site ID. - * * @return void */ - private function activate_child_theme(): void { + private function activate_child_theme_on_new_site(): void { add_action( - 'wpmu_new_blog', + 'wp_initialize_site', function ( $site_id ) { $stylesheet = 'goodbids-nonprofit'; // Switch to the new site switch_to_blog( $site_id ); - // Check if we the Goodbids child theme exists + // Check if the Goodbids child theme exists if ( ! wp_get_theme( $stylesheet )->exists() ) { return; } + switch_theme( $stylesheet ); restore_current_blog();