diff --git a/includes/class-create-block-theme-api.php b/includes/class-create-block-theme-api.php index b6f6c241..0285b7be 100644 --- a/includes/class-create-block-theme-api.php +++ b/includes/class-create-block-theme-api.php @@ -203,6 +203,8 @@ function rest_clone_theme( $request ) { $response = CBT_Theme_Create::clone_current_theme( $this->sanitize_theme_data( $request->get_params() ) ); + wp_cache_flush(); + if ( is_wp_error( $response ) ) { return $response; } @@ -224,6 +226,8 @@ function rest_create_child_theme( $request ) { $response = CBT_Theme_Create::create_child_theme( $theme, $screenshot ); + wp_cache_flush(); + if ( is_wp_error( $response ) ) { return $response; } @@ -240,6 +244,8 @@ function rest_create_variation( $request ) { $response = CBT_Theme_JSON::add_theme_json_variation_to_local( 'variation', $this->sanitize_theme_data( $request->get_params() ) ); + wp_cache_flush(); + if ( is_wp_error( $response ) ) { return $response; } @@ -260,6 +266,8 @@ function rest_create_blank_theme( $request ) { $response = CBT_Theme_Create::create_blank_theme( $theme, $screenshot ); + wp_cache_flush(); + if ( is_wp_error( $response ) ) { return $response; } @@ -320,6 +328,8 @@ function rest_export_cloned_theme( $request ) { $zip->close(); + wp_cache_flush(); + header( 'Content-Type: application/zip' ); header( 'Content-Disposition: attachment; filename=' . $theme['slug'] . '.zip' ); header( 'Content-Length: ' . filesize( $filename ) ); @@ -373,6 +383,8 @@ function rest_export_child_cloned_theme( $request ) { $zip->close(); + wp_cache_flush(); + header( 'Content-Type: application/zip' ); header( 'Content-Disposition: attachment; filename=' . $theme['slug'] . '.zip' ); header( 'Content-Length: ' . filesize( $filename ) ); @@ -390,7 +402,7 @@ function rest_export_theme( $request ) { __( 'Unable to create a zip file. ZipArchive not available.', 'create-block-theme' ), ); } - + wp_cache_flush(); $theme_slug = wp_get_theme()->get( 'TextDomain' ); // Create ZIP file in the temporary directory. @@ -400,6 +412,7 @@ function rest_export_theme( $request ) { $zip = CBT_Theme_Zip::copy_theme_to_zip( $zip, null, null ); if ( is_child_theme() ) { + wp_cache_flush(); $zip = CBT_Theme_Zip::add_templates_to_zip( $zip, 'current', $theme_slug ); $theme_json = CBT_Theme_JSON_Resolver::export_theme_data( 'current' ); } else { @@ -413,6 +426,8 @@ function rest_export_theme( $request ) { $zip->close(); + wp_cache_flush(); + header( 'Content-Type: application/zip' ); header( 'Content-Disposition: attachment; filename=' . $theme_slug . '.zip' ); header( 'Content-Length: ' . filesize( $filename ) ); @@ -448,6 +463,8 @@ function rest_update_theme( $request ) { return $response; } + wp_cache_flush(); + return new WP_REST_Response( array( 'status' => 'SUCCESS', @@ -489,6 +506,8 @@ function rest_save_theme( $request ) { CBT_Theme_Styles::clear_user_styles_customizations(); } + wp_cache_flush(); + return new WP_REST_Response( array( 'status' => 'SUCCESS',