Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WordPress 7.2's attachment edit lineage work in WordPress/wordpress-develop#13303 adds
_wp_attachment_edit_root_id: the attachment ID an edit chain started from, written when/wp/v2/media/<id>/editcreates a derivative attachment. This follows up on the importer question raised in review.Add the key to the skip list in
is_valid_meta_key(), alongside_wp_attached_file,_wp_attachment_metadata, and_wp_font_face_file, following the comment and skip-list change in #264.The value is a source-site attachment ID. IDs are reassigned on import, so importing it unchanged can point at an unrelated attachment already on the destination. For example, a source root ID of 42 could identify somebody else's image on the destination even if the imported root becomes attachment 100. Consumers — the media editor's “Restore original image”, the REST
edit_rootfield, and thewp:edit-rootlink — could then present that unrelated image as the original.Skipping is safe because the feature records lineage going forward only and every consumer treats absent lineage as untracked. Unlike regenerated attachment metadata, this key is not regenerated after import: the lineage is simply severed. That is deliberately lossy, but permitted by the feature's design and safer than preserving an incorrect relationship.
Follow-up (not implemented here)
The lossless fix is to remap the ID like
_thumbnail_id: collect it during postmeta import and rewrite it to a destination ID inremap_featured_images(). Remap when the root attachment is part of the same import and drop the meta when it is not. If that handling lands later, remove this key from the skip list.Validation
git diff --checkpass.is_valid_meta_key()smoke check passes for all five skipped keys and four preserved keys, including_thumbnail_id, image alt text, custom meta, and a similarly named key.