← All changes
|
backend/src/Controllers/Cloud/Libraries/LibraryItemPostController.php
+166
-76
0.7.0.2
→
1.4.7
View file →
| @@ -31,19 +31,13 @@ | ||
| 31 | 31 | */ |
| 32 | 32 | public function register_routes() { |
| 33 | 33 | |
| 34 | 34 | $this->route( |
| 35 | - '/posts/preview_library_post/(?P<item_id>\d+)', | |
| 35 | + '/posts/preview_library_post/', | |
| 36 | 36 | [ |
| 37 | 37 | [ |
| 38 | 38 | 'methods' => \WP_REST_Server::CREATABLE, |
| 39 | 39 | 'callback' => [ $this, 'preview_library_post' ], |
| 40 | - 'args' => [ | |
| 41 | - 'item_id' => [ | |
| 42 | - 'required' => true, | |
| 43 | - 'type' => 'number', | |
| 44 | - ], | |
| 45 | - ], | |
| 46 | 40 | 'permission_callback' => function () { |
| 47 | 41 | return current_user_can( 'edit_others_posts' ); |
| 48 | 42 | }, |
| 49 | 43 | ], |
| @@ -79,13 +73,13 @@ | ||
| 79 | 73 | [ |
| 80 | 74 | 'methods' => \WP_REST_Server::CREATABLE, |
| 81 | 75 | 'callback' => [ $this, 'sync_to_library' ], |
| 82 | 76 | 'args' => [ |
| 83 | - 'id' => [ | |
| 77 | + 'id' => [ | |
| 84 | 78 | 'required' => true, |
| 85 | 79 | 'type' => 'number', |
| 86 | 80 | ], |
| 87 | - 'item_id' => [ | |
| 81 | + 'item_id' => [ | |
| 88 | 82 | 'required' => true, |
| 89 | 83 | 'type' => 'number', |
| 90 | 84 | ], |
| 91 | 85 | ], |
| @@ -96,22 +90,31 @@ | ||
| 96 | 90 | ] |
| 97 | 91 | ); |
| 98 | 92 | |
| 99 | 93 | $this->route( |
| 100 | - '/posts/import_from_library/(?P<item_id>\d+)', | |
| 94 | + '/posts/import_from_library/', | |
| 101 | 95 | [ |
| 102 | 96 | [ |
| 103 | 97 | 'methods' => \WP_REST_Server::CREATABLE, |
| 104 | 98 | 'callback' => [ $this, 'import_from_library' ], |
| 99 | + 'permission_callback' => function () { | |
| 100 | + return current_user_can( 'edit_others_posts' ); | |
| 101 | + }, | |
| 102 | + ], | |
| 103 | + ] | |
| 104 | + ); | |
| 105 | + | |
| 106 | + $this->route( | |
| 107 | + '/posts/import_post_thumb_from_library/(?P<post_id>\d+)', | |
| 108 | + [ | |
| 109 | + [ | |
| 110 | + 'methods' => \WP_REST_Server::CREATABLE, | |
| 111 | + 'callback' => [ $this, 'import_post_thumb_from_library' ], | |
| 105 | 112 | 'args' => [ |
| 106 | - 'item_id' => [ | |
| 113 | + 'post_id' => [ | |
| 107 | 114 | 'required' => true, |
| 108 | 115 | 'type' => 'number', |
| 109 | 116 | ], |
| 110 | - 'import_media' => [ | |
| 111 | - 'type' => 'number', | |
| 112 | - 'default' => 1, | |
| 113 | - ], | |
| 114 | 117 | ], |
| 115 | 118 | 'permission_callback' => function () { |
| 116 | 119 | return current_user_can( 'edit_others_posts' ); |
| 117 | 120 | }, |
| @@ -119,26 +122,37 @@ | ||
| 119 | 122 | ] |
| 120 | 123 | ); |
| 121 | 124 | |
| 122 | 125 | $this->route( |
| 123 | - '/posts/(?P<id>\d+)/sync_from_library/(?P<item_id>\d+)', | |
| 126 | + '/posts/import_post_media_from_library/(?P<post_id>\d+)', | |
| 124 | 127 | [ |
| 125 | 128 | [ |
| 126 | 129 | 'methods' => \WP_REST_Server::CREATABLE, |
| 127 | - 'callback' => [ $this, 'sync_from_library' ], | |
| 130 | + 'callback' => [ $this, 'import_post_media_from_library' ], | |
| 128 | 131 | 'args' => [ |
| 129 | - 'id' => [ | |
| 132 | + 'post_id' => [ | |
| 130 | 133 | 'required' => true, |
| 131 | 134 | 'type' => 'number', |
| 132 | 135 | ], |
| 133 | - 'item_id' => [ | |
| 136 | + ], | |
| 137 | + 'permission_callback' => function () { | |
| 138 | + return current_user_can( 'edit_others_posts' ); | |
| 139 | + }, | |
| 140 | + ], | |
| 141 | + ] | |
| 142 | + ); | |
| 143 | + | |
| 144 | + $this->route( | |
| 145 | + '/posts/(?P<id>\d+)/sync_from_library/', | |
| 146 | + [ | |
| 147 | + [ | |
| 148 | + 'methods' => \WP_REST_Server::CREATABLE, | |
| 149 | + 'callback' => [ $this, 'sync_from_library' ], | |
| 150 | + 'args' => [ | |
| 151 | + 'id' => [ | |
| 134 | 152 | 'required' => true, |
| 135 | 153 | 'type' => 'number', |
| 136 | 154 | ], |
| 137 | - 'import_media' => [ | |
| 138 | - 'type' => 'number', | |
| 139 | - 'default' => 1, | |
| 140 | - ], | |
| 141 | 155 | ], |
| 142 | 156 | 'permission_callback' => function () { |
| 143 | 157 | return current_user_can( 'edit_others_posts' ); |
| 144 | 158 | }, |
| @@ -155,16 +169,25 @@ | ||
| 155 | 169 | */ |
| 156 | 170 | public function preview_library_post( $request ) { |
| 157 | 171 | global $wpdb; |
| 158 | 172 | |
| 159 | - $item_id = $request->get_param( 'item_id' ); | |
| 173 | + $data = $request->get_param( 'item' ); | |
| 174 | + $item = $data ? json_decode( $data ) : null; | |
| 160 | 175 | |
| 176 | + if ( ! $item ) { | |
| 177 | + return rest_ensure_response( | |
| 178 | + [ | |
| 179 | + 'error' => true, | |
| 180 | + ] | |
| 181 | + ); | |
| 182 | + } | |
| 183 | + | |
| 161 | 184 | $meta = $wpdb->get_row( |
| 162 | 185 | $wpdb->prepare( |
| 163 | 186 | "SELECT * FROM $wpdb->postmeta |
| 164 | 187 | WHERE meta_key = '_fl_asst_preview_library_item_id' |
| 165 | 188 | AND meta_value = %s", |
| 166 | - $item_id | |
| 189 | + $item->id | |
| 167 | 190 | ) |
| 168 | 191 | ); |
| 169 | 192 | |
| 170 | 193 | if ( $meta ) { |
| @@ -186,10 +209,12 @@ | ||
| 186 | 209 | 'post_status' => 'auto-draft', |
| 187 | 210 | ] |
| 188 | 211 | ); |
| 189 | 212 | |
| 190 | - update_post_meta( $post_id, '_fl_asst_preview_library_item_id', $item_id ); | |
| 213 | + update_post_meta( $post_id, '_fl_asst_preview_library_item_id', $item->id ); | |
| 191 | 214 | |
| 215 | + $this->replace_attachment_urls_with_cloud_urls( $item, $post_id ); | |
| 216 | + | |
| 192 | 217 | return rest_ensure_response( |
| 193 | 218 | [ |
| 194 | 219 | 'url' => PreviewHelper::get_post_preview_url( $post_id ), |
| 195 | 220 | ] |
| @@ -203,12 +228,12 @@ | ||
| 203 | 228 | * @param object $post |
| 204 | 229 | * @return array |
| 205 | 230 | */ |
| 206 | 231 | public function get_save_data( $request, $post ) { |
| 207 | - return [ | |
| 232 | + $data = [ | |
| 208 | 233 | 'name' => $post->post_title, |
| 209 | 234 | 'type' => 'post', |
| 210 | - 'data' => [ | |
| 235 | + 'post_data' => [ | |
| 211 | 236 | 'post' => [ |
| 212 | 237 | 'comment_status' => $post->comment_status, |
| 213 | 238 | 'menu_order' => $post->menu_order, |
| 214 | 239 | 'ping_status' => $post->ping_status, |
| @@ -223,13 +248,20 @@ | ||
| 223 | 248 | 'terms' => $this->get_post_terms( $post ), |
| 224 | 249 | |
| 225 | 250 | ], |
| 226 | 251 | 'media' => [ |
| 227 | - 'thumb' => get_attached_file( get_post_thumbnail_id( $post ) ), | |
| 228 | 252 | 'attachments' => $this->get_post_image_paths( $post ), |
| 229 | 253 | ], |
| 230 | 254 | 'screenshot' => $this->get_post_screenshot( $request, $post ), |
| 231 | 255 | ]; |
| 256 | + | |
| 257 | + $thumbnail = get_attached_file( get_post_thumbnail_id( $post ) ); | |
| 258 | + | |
| 259 | + if ($thumbnail) { | |
| 260 | + $data['media']['thumb'] = $thumbnail; | |
| 261 | + } | |
| 262 | + | |
| 263 | + return $data; | |
| 232 | 264 | } |
| 233 | 265 | |
| 234 | 266 | /** |
| 235 | 267 | * Saves a post to a cloud library. |
| @@ -259,12 +291,13 @@ | ||
| 259 | 291 | $id = $request->get_param( 'id' ); |
| 260 | 292 | $item_id = $request->get_param( 'item_id' ); |
| 261 | 293 | $post = get_post( $id ); |
| 262 | 294 | $client = new CloudClient; |
| 295 | + $data = $this->get_save_data( $request, $post ); | |
| 263 | 296 | |
| 264 | 297 | return $client->libraries->update_item( |
| 265 | 298 | $item_id, |
| 266 | - $this->get_save_data( $request, $post ) | |
| 299 | + $data | |
| 267 | 300 | ); |
| 268 | 301 | } |
| 269 | 302 | |
| 270 | 303 | /** |
| @@ -273,13 +306,24 @@ | ||
| 273 | 306 | * @param object $request |
| 274 | 307 | * @return array |
| 275 | 308 | */ |
| 276 | 309 | public function import_from_library( $request ) { |
| 277 | - $item_id = $request->get_param( 'item_id' ); | |
| 278 | - $import_media = ! ! $request->get_param( 'import_media' ); | |
| 310 | + $data = $request->get_param( 'item' ); | |
| 311 | + $item = $data ? json_decode( $data ) : null; | |
| 312 | + | |
| 313 | + if ( ! $item ) { | |
| 314 | + return rest_ensure_response( | |
| 315 | + [ | |
| 316 | + 'error' => true, | |
| 317 | + ] | |
| 318 | + ); | |
| 319 | + } | |
| 320 | + | |
| 279 | 321 | $client = new CloudClient; |
| 280 | - $response = $client->libraries->get_item( $item_id ); | |
| 281 | - $post_data = $response->data->post; | |
| 322 | + $item = $client->libraries->get_item( $item->id ); | |
| 323 | + $post_data = $item->data->post; | |
| 324 | + $meta_data = $item->data->meta; | |
| 325 | + $term_data = $item->data->terms; | |
| 282 | 326 | |
| 283 | 327 | $new_post_id = wp_insert_post( |
| 284 | 328 | [ |
| 285 | 329 | 'comment_status' => $post_data->comment_status, |
| @@ -289,9 +333,9 @@ | ||
| 289 | 333 | 'post_content' => $post_data->post_content ? $post_data->post_content : '', |
| 290 | 334 | 'post_excerpt' => $post_data->post_excerpt ? $post_data->post_excerpt : '', |
| 291 | 335 | 'post_mime_type' => $post_data->post_mime_type, |
| 292 | 336 | 'post_name' => $post_data->post_name, |
| 293 | - 'post_status' => 'draft', | |
| 337 | + 'post_status' => 'publish', | |
| 294 | 338 | 'post_title' => $post_data->post_title, |
| 295 | 339 | 'post_type' => $post_data->post_type, |
| 296 | 340 | ] |
| 297 | 341 | ); |
| @@ -303,12 +347,11 @@ | ||
| 303 | 347 | ] |
| 304 | 348 | ); |
| 305 | 349 | } |
| 306 | 350 | |
| 307 | - $this->import_post_meta_from_library( $new_post_id, $response->data->meta ); | |
| 308 | - $this->import_post_terms_from_library( $new_post_id, $response->data->terms ); | |
| 309 | - $this->import_post_media_from_library( $new_post_id, $response->media, $import_media ); | |
| 310 | - $this->regenerate_builder_cache( $response ); | |
| 351 | + $this->import_post_meta_from_library( $new_post_id, $meta_data ); | |
| 352 | + $this->import_post_terms_from_library( $new_post_id, $term_data ); | |
| 353 | + $this->regenerate_builder_cache( $new_post_id, $item ); | |
| 311 | 354 | |
| 312 | 355 | return rest_ensure_response( |
| 313 | 356 | $this->posts->transform( |
| 314 | 357 | get_post( $new_post_id ) |
| @@ -323,17 +366,29 @@ | ||
| 323 | 366 | * @return array |
| 324 | 367 | */ |
| 325 | 368 | public function sync_from_library( $request ) { |
| 326 | 369 | $post_id = $request->get_param( 'id' ); |
| 327 | - $item_id = $request->get_param( 'item_id' ); | |
| 328 | - $import_media = ! ! $request->get_param( 'import_media' ); | |
| 370 | + $data = $request->get_param( 'item' ); | |
| 371 | + $item = $data ? json_decode( $data ) : null; | |
| 372 | + | |
| 373 | + if ( ! $item ) { | |
| 374 | + return rest_ensure_response( | |
| 375 | + [ | |
| 376 | + 'error' => true, | |
| 377 | + ] | |
| 378 | + ); | |
| 379 | + } | |
| 380 | + | |
| 329 | 381 | $client = new CloudClient; |
| 330 | - $response = $client->libraries->get_item( $item_id ); | |
| 382 | + $item = $client->libraries->get_item( $item->id ); | |
| 383 | + $post_data = $item->data->post; | |
| 384 | + $meta_data = $item->data->meta; | |
| 385 | + $term_data = $item->data->terms; | |
| 331 | 386 | |
| 332 | 387 | $updated = wp_update_post( |
| 333 | 388 | [ |
| 334 | 389 | 'ID' => $post_id, |
| 335 | - 'post_content' => $response->data->post->post_content, | |
| 390 | + 'post_content' => $post_data->post_content, | |
| 336 | 391 | ] |
| 337 | 392 | ); |
| 338 | 393 | |
| 339 | 394 | if ( is_wp_error( $updated ) ) { |
| @@ -343,12 +398,11 @@ | ||
| 343 | 398 | ] |
| 344 | 399 | ); |
| 345 | 400 | } |
| 346 | 401 | |
| 347 | - $this->import_post_meta_from_library( $post_id, $response->data->meta ); | |
| 348 | - $this->import_post_terms_from_library( $post_id, $response->data->terms ); | |
| 349 | - $this->import_post_media_from_library( $post_id, $response->media, $import_media ); | |
| 350 | - $this->regenerate_builder_cache( $response ); | |
| 402 | + $this->import_post_meta_from_library( $post_id, $meta_data ); | |
| 403 | + $this->import_post_terms_from_library( $post_id, $term_data ); | |
| 404 | + $this->regenerate_builder_cache( $post_id, $item ); | |
| 351 | 405 | |
| 352 | 406 | return rest_ensure_response( |
| 353 | 407 | $this->posts->transform( |
| 354 | 408 | get_post( $post_id ) |
| @@ -369,18 +423,24 @@ | ||
| 369 | 423 | if ( ! $meta || ! is_object( $meta ) ) { |
| 370 | 424 | return; |
| 371 | 425 | } |
| 372 | 426 | |
| 427 | + if ( isset( $meta->_fl_builder_data ) ) { | |
| 428 | + $meta->_fl_builder_draft = $meta->_fl_builder_data; | |
| 429 | + $meta->_fl_builder_draft_settings = $meta->_fl_builder_data_settings; | |
| 430 | + } | |
| 431 | + | |
| 373 | 432 | foreach ( $meta as $meta_key => $meta_value ) { |
| 374 | 433 | if ( metadata_exists( 'post', $post_id, $meta_key ) ) { |
| 375 | 434 | delete_metadata( 'post', $post_id, $meta_key ); |
| 376 | 435 | } |
| 377 | - | |
| 378 | - foreach ( $meta_value as $value ) { | |
| 379 | - $value = addslashes( $value ); | |
| 380 | - // @codingStandardsIgnoreStart | |
| 381 | - $wpdb->query( "INSERT INTO {$wpdb->postmeta} (post_id, meta_key, meta_value) values ({$post_id}, '{$meta_key}', '{$value}')" ); | |
| 382 | - // @codingStandardsIgnoreEnd | |
| 436 | + if ( is_array( $meta_value ) && count( $meta_value ) !== 0 ) { | |
| 437 | + foreach ( $meta_value as $value ) { | |
| 438 | + $value = addslashes( $value ); | |
| 439 | + // @codingStandardsIgnoreStart | |
| 440 | + $wpdb->query( "INSERT INTO {$wpdb->postmeta} (post_id, meta_key, meta_value) values ({$post_id}, '{$meta_key}', '{$value}')" ); | |
| 441 | + // @codingStandardsIgnoreEnd | |
| 442 | + } | |
| 383 | 443 | } |
| 384 | 444 | } |
| 385 | 445 | } |
| 386 | 446 | |
| @@ -391,8 +451,10 @@ | ||
| 391 | 451 | * @param array $terms |
| 392 | 452 | * @return void |
| 393 | 453 | */ |
| 394 | 454 | public function import_post_terms_from_library( $post_id, $terms ) { |
| 455 | + $terms = is_object( $terms ) ? [ $terms ] : $terms; | |
| 456 | + | |
| 395 | 457 | if ( ! $terms || ! is_array( $terms ) || 0 === count( $terms ) ) { |
| 396 | 458 | return; |
| 397 | 459 | } |
| 398 | 460 | |
| @@ -401,9 +463,9 @@ | ||
| 401 | 463 | |
| 402 | 464 | foreach ( $terms as $term ) { |
| 403 | 465 | if ( ! isset( $term->name ) || ! isset( $term->taxonomy ) ) { |
| 404 | 466 | continue; |
| 405 | - } else if ( ! taxonomy_exists( $term->taxonomy ) ) { | |
| 467 | + } elseif ( ! taxonomy_exists( $term->taxonomy ) ) { | |
| 406 | 468 | continue; |
| 407 | 469 | } elseif ( ! isset( $taxonomy_terms ) ) { |
| 408 | 470 | $taxonomy_terms[ $term->taxonomy ] = []; |
| 409 | 471 | } |
| @@ -424,9 +486,9 @@ | ||
| 424 | 486 | ); |
| 425 | 487 | $term_id = $is_hierarchical ? $new_term['term_taxonomy_id'] : $term->name; |
| 426 | 488 | } |
| 427 | 489 | |
| 428 | - $taxonomy_terms[ $term->taxonomy ] = $term_id; | |
| 490 | + $taxonomy_terms[ $term->taxonomy ][] = $term_id; | |
| 429 | 491 | } |
| 430 | 492 | |
| 431 | 493 | foreach ( $taxonomy_terms as $taxonomy => $terms ) { |
| 432 | 494 | wp_delete_object_term_relationships( $post_id, $taxonomy ); |
| @@ -466,40 +528,65 @@ | ||
| 466 | 528 | */ |
| 467 | 529 | public function get_post_screenshot( $request, $post ) { |
| 468 | 530 | $url = PreviewHelper::get_post_preview_url( $post ); |
| 469 | 531 | $url = add_query_arg( 'fl_asst_screenshot', '1', $url ); |
| 470 | - return ScreenshotHelper::get_for_request( $request, $url ); | |
| 532 | + return ScreenshotHelper::get_for_rest_request( $request, $url ); | |
| 471 | 533 | } |
| 472 | 534 | |
| 473 | 535 | /** |
| 474 | - * Imports the media for a post. | |
| 536 | + * Imports the featured image for a post. | |
| 475 | 537 | * |
| 476 | - * @param int $post_id | |
| 477 | - * @param object $media | |
| 478 | - * @param bool $import | |
| 479 | - * @return void | |
| 538 | + * @param object $request | |
| 539 | + * @return array | |
| 480 | 540 | */ |
| 481 | - public function import_post_media_from_library( $post_id, $media, $import = true ) { | |
| 541 | + public function import_post_thumb_from_library( $request ) { | |
| 542 | + $post_id = $request->get_param( 'post_id' ); | |
| 543 | + $thumb = $request->get_param( 'thumb' ); | |
| 482 | 544 | $service = new MediaLibraryService(); |
| 483 | 545 | |
| 484 | - // Import post thumbnail | |
| 485 | - if ( $import && isset( $media->thumb ) && 'screenshot.png' !== $media->thumb->file_name ) { | |
| 486 | - $response = $service->import_cloud_media( $media->thumb, $post_id ); | |
| 546 | + if ( ! preg_match( '/screenshot\.(png|jpg|gif)/', $thumb['file_name'] ) ) { | |
| 547 | + $response = $service->import_cloud_media( $thumb, $post_id ); | |
| 487 | 548 | set_post_thumbnail( $post_id, $response['id'] ); |
| 488 | 549 | } |
| 489 | 550 | |
| 490 | - // Import post attachments | |
| 491 | - if ( isset( $media->attachments ) ) { | |
| 551 | + return [ 'success' => true ]; | |
| 552 | + } | |
| 553 | + | |
| 554 | + /** | |
| 555 | + * Imports a media item for a post. | |
| 556 | + * | |
| 557 | + * @param object $request | |
| 558 | + * @return array | |
| 559 | + */ | |
| 560 | + public function import_post_media_from_library( $request ) { | |
| 561 | + $post_id = $request->get_param( 'post_id' ); | |
| 562 | + $media = $request->get_param( 'media' ); | |
| 563 | + $service = new MediaLibraryService(); | |
| 564 | + | |
| 565 | + $imported = []; | |
| 566 | + $response = $service->import_cloud_media( $media, $post_id ); | |
| 567 | + $imported[ $media['file_name'] ] = wp_get_attachment_metadata( $response['id'] ); | |
| 568 | + $imported[ $media['file_name'] ]['id'] = $response['id']; | |
| 569 | + | |
| 570 | + $this->replace_imported_attachment_urls_in_content( $post_id, $imported ); | |
| 571 | + $this->replace_imported_attachment_urls_in_meta( $post_id, $imported ); | |
| 572 | + | |
| 573 | + return [ 'success' => true ]; | |
| 574 | + } | |
| 575 | + | |
| 576 | + /** | |
| 577 | + * Replace attachment urls with urls from the cloud. | |
| 578 | + * | |
| 579 | + * @param object $item | |
| 580 | + * @param int $post_id | |
| 581 | + * @return void | |
| 582 | + */ | |
| 583 | + public function replace_attachment_urls_with_cloud_urls( $item, $post_id ) { | |
| 584 | + if ( isset( $item->media->attachments ) ) { | |
| 492 | 585 | $imported = []; |
| 493 | 586 | |
| 494 | - foreach ( $media->attachments as $attachment ) { | |
| 495 | - if ( $import ) { | |
| 496 | - $response = $service->import_cloud_media( $attachment, $post_id ); | |
| 497 | - $imported[ $attachment->file_name ] = wp_get_attachment_metadata( $response['id'] ); | |
| 498 | - $imported[ $attachment->file_name ]['id'] = $response['id']; | |
| 499 | - } else { | |
| 500 | - $imported[ $attachment->file_name ] = $attachment; | |
| 501 | - } | |
| 587 | + foreach ( $item->media->attachments as $attachment ) { | |
| 588 | + $imported[ $attachment->file_name ] = $attachment; | |
| 502 | 589 | } |
| 503 | 590 | |
| 504 | 591 | $this->replace_imported_attachment_urls_in_content( $post_id, $imported ); |
| 505 | 592 | $this->replace_imported_attachment_urls_in_meta( $post_id, $imported ); |
| @@ -575,11 +662,14 @@ | ||
| 575 | 662 | * |
| 576 | 663 | * @param object $item |
| 577 | 664 | * @return void |
| 578 | 665 | */ |
| 579 | - public function regenerate_builder_cache( $item ) { | |
| 666 | + public function regenerate_builder_cache( $post_id, $item ) { | |
| 580 | 667 | $meta = (array) $item->data->meta; |
| 581 | 668 | |
| 669 | + if ( isset( $meta['_fl_builder_data'] ) && class_exists( 'FLBuilderModel' ) ) { | |
| 670 | + \FLBuilderModel::delete_all_asset_cache( $post_id ); | |
| 671 | + } | |
| 582 | 672 | if ( isset( $meta['_elementor_data'] ) && class_exists( 'Elementor\Plugin' ) ) { |
| 583 | 673 | \Elementor\Plugin::$instance->files_manager->clear_cache(); |
| 584 | 674 | } |
| 585 | 675 | } |