From a0bc24654d054106a9ee6b56d4d9d3b495d79395 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Tue, 13 Jul 2021 16:13:19 +0100 Subject: [PATCH] Ensure that attachment_metadata is created and updated --- php/sync/class-download-sync.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/php/sync/class-download-sync.php b/php/sync/class-download-sync.php index 77c05a37b..deb51803b 100644 --- a/php/sync/class-download-sync.php +++ b/php/sync/class-download-sync.php @@ -174,7 +174,8 @@ public function download_asset( $attachment_id, $source = null, $date = null ) { // Prepare the asset. update_attached_file( $attachment_id, $upload['file'] ); - wp_generate_attachment_metadata( $attachment_id, $upload['file'] ); + + wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $upload['file'] ) ); // Update the folder synced flag. $public_id = $this->media->get_public_id( $attachment_id );