Skip to content

Commit

Permalink
Merge pull request #1827 from Codeinwp/fix/theme-switch
Browse files Browse the repository at this point in the history
Regenerate saved style on theme change
  • Loading branch information
HardeepAsrani authored Aug 31, 2023
2 parents d12d6c5 + 544881c commit 1004e7e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion inc/server/class-dashboard-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );
}

/**
Expand Down Expand Up @@ -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
Expand All @@ -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.
*
Expand Down

0 comments on commit 1004e7e

Please sign in to comment.