From 32e950c0b462a256f274356415294df6c1ca4526 Mon Sep 17 00:00:00 2001 From: "Soare Robert Daniel (Mac 2023)" Date: Wed, 23 Aug 2023 16:01:27 +0300 Subject: [PATCH 1/2] fix: regenerate style on theme change --- inc/server/class-dashboard-server.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/server/class-dashboard-server.php b/inc/server/class-dashboard-server.php index d3ea489c7..088fc7e7e 100644 --- a/inc/server/class-dashboard-server.php +++ b/inc/server/class-dashboard-server.php @@ -38,6 +38,7 @@ class Dashboard_Server { */ public function init() { add_action( 'rest_api_init', array( $this, 'register_routes' ) ); + add_action( 'after_switch_theme', array( $this, 'regenerate_styles' ) ); } /** @@ -65,7 +66,7 @@ public function register_routes() { * Regenerate styles. * * @param \WP_REST_Request $request The request. - * + * * @return \WP_REST_Response * @since 2.0.9 * @access public From 544881cfea0bb915c966c396a1aaff3873c56bd2 Mon Sep 17 00:00:00 2001 From: "Soare Robert Daniel (Mac 2023)" Date: Mon, 28 Aug 2023 11:40:02 +0300 Subject: [PATCH 2/2] chore: add proxy function --- inc/server/class-dashboard-server.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/inc/server/class-dashboard-server.php b/inc/server/class-dashboard-server.php index 088fc7e7e..a6798a7c1 100644 --- a/inc/server/class-dashboard-server.php +++ b/inc/server/class-dashboard-server.php @@ -38,7 +38,7 @@ class Dashboard_Server { */ public function init() { add_action( 'rest_api_init', array( $this, 'register_routes' ) ); - add_action( 'after_switch_theme', array( $this, 'regenerate_styles' ) ); + add_action( 'after_switch_theme', array( $this, 'regenerate_styles_on_theme_change' ) ); } /** @@ -75,6 +75,15 @@ public function rest_regenerate_styles( \WP_REST_Request $request ) { return self::regenerate_styles(); } + /** + * Regenerate styles on theme change. + * + * @since 2.3 + */ + public function regenerate_styles_on_theme_change() { + self::regenerate_styles(); + } + /** * Function to delete Otter generated styles. *