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
This commit is contained in:
joedolson 2023-02-01 20:31:14 +00:00
parent b0521eaa50
commit 237cb1da8f
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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.