diff --git a/src/wp-admin/includes/image-edit.php b/src/wp-admin/includes/image-edit.php index e814fc47e78e..91f3fc8f36ce 100644 --- a/src/wp-admin/includes/image-edit.php +++ b/src/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;