@@ -23,7 +23,7 @@ public function init() {
23
23
add_action ('submenu_file ' , [$ this , 'hide_sub_menu ' ]);
24
24
25
25
add_action ( 'edit_attachment ' , [ $ this , 'save_attachment_filename ' ] );
26
- add_action ( 'optml_attachment_renamed ' , [$ this , 'bust_cached_assets ' ], 10 , 2 );
26
+ add_action ( 'optml_after_attachment_url_replace ' , [$ this , 'bust_cached_assets ' ], 10 , 3 );
27
27
}
28
28
29
29
public function add_metabox ( string $ post_type , \WP_Post $ post ) {
@@ -282,8 +282,25 @@ public function save_attachment_filename( $post_id ) {
282
282
$ renamer ->rename ();
283
283
}
284
284
285
- public function bust_cached_assets () {
285
+ /**
286
+ * Bust cached assets
287
+ *
288
+ * @param int $attachment_id The attachment ID
289
+ * @param string $new_guid The new GUID
290
+ * @param string $old_guid The old GUID
291
+ */
292
+ public function bust_cached_assets ( $ attachment_id , $ new_guid , $ old_guid ) {
293
+ if (
294
+ class_exists ('\ThemeIsle\GutenbergBlocks\Server\Dashboard_Server ' ) &&
295
+ is_callable (['\ThemeIsle\GutenbergBlocks\Server\Dashboard_Server ' , 'regenerate_styles ' ])
296
+ ) {
297
+ \ThemeIsle \GutenbergBlocks \Server \Dashboard_Server::regenerate_styles ();
298
+ }
286
299
287
-
300
+ if ( did_action ( 'elementor/loaded ' ) ) {
301
+ if ( class_exists ( '\Elementor\Plugin ' ) ) {
302
+ \Elementor \Plugin::instance ()->files_manager ->clear_cache ();
303
+ }
304
+ }
288
305
}
289
306
}
0 commit comments