You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When editing an image, the "Save" request relies on the attachment ID in the image block. However in some edge cases that ID may not match the edited image's attachment. For example after all posts have been exported from one website and imported in another.
Then, if the wrong attachment ID is not for an image, the Save request fails, but if the wrong ID is for another image's attachment, the other image is edited and replaced in the image block.
To reproduce
Steps to reproduce the behavior:
Upload two images and add them to a post.
From the Code editor replace the ID on the first image (in the block's args and in the wp-image-nnnn class) with the ID for the second. Save and preview the post, notice the first image doesn't have srcset, etc, as the attachment ID is wrong.
Edit the first image and save. At this point the edits are applied to the second image, and the first image is replaced with the second.
To fix it will need to use the new wp_image_file_matches_image_meta() on the API side to confirm the src and attachment ID are for the same image.
Unfortunately I just had the same issue with the latest 5.9.2 WP Version.
The content was imported with WP All Import and the images carried their old IDs. If I change the image size from the dropdown, the image is being replaced by another image with the "wrong" ID is defined in the block.
Describe the bug
When editing an image, the "Save" request relies on the attachment ID in the image block. However in some edge cases that ID may not match the edited image's attachment. For example after all posts have been exported from one website and imported in another.
Then, if the wrong attachment ID is not for an image, the Save request fails, but if the wrong ID is for another image's attachment, the other image is edited and replaced in the image block.
To reproduce
Steps to reproduce the behavior:
wp-image-nnnn
class) with the ID for the second. Save and preview the post, notice the first image doesn't havesrcset
, etc, as the attachment ID is wrong.To fix it will need to use the new
wp_image_file_matches_image_meta()
on the API side to confirm the src and attachment ID are for the same image.Opened https://core.trac.wordpress.org/ticket/50565 for trunk.
The text was updated successfully, but these errors were encountered: