From 237cb1da8f0137c8624274e84b58cc83b90f4d1a Mon Sep 17 00:00:00 2001 From: joedolson Date: Wed, 1 Feb 2023 20:31:14 +0000 Subject: [PATCH] Media: Remove meta data after restoring w/IMAGE_EDIT_OVERWRITE. When IMAGE_EDIT_OVERWRITE is defined as true the meta field `_wp_attachment_backup_sizes` is deleted after an image is restored. Props mitogh, jeawhanlee, robinwpdeveloper, iapial. Fixes #55150. Built from https://develop.svn.wordpress.org/trunk@55180 git-svn-id: http://core.svn.wordpress.org/trunk@54713 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/image-edit.php | 3 +++ wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php index 746c0bafbd..281ce03c0f 100644 --- a/wp-admin/includes/image-edit.php +++ b/wp-admin/includes/image-edit.php @@ -810,6 +810,9 @@ function wp_restore_image( $post_id ) { $msg->error = __( 'Image metadata is inconsistent.' ); } else { $msg->msg = __( 'Image restored successfully.' ); + if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE ) { + delete_post_meta( $post_id, '_wp_attachment_backup_sizes' ); + } } return $msg; diff --git a/wp-includes/version.php b/wp-includes/version.php index a07b271888..2d1cd4684d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-55179'; +$wp_version = '6.2-alpha-55180'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.