Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate saved style on theme change #1827

Merged
merged 3 commits into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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