diff --git a/inc/server/class-dashboard-server.php b/inc/server/class-dashboard-server.php index d3ea489c7..a6798a7c1 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_on_theme_change' ) ); } /** @@ -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 @@ -74,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. *