-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Media Fields: Add an attached_to field #74432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Size Change: +724 B (+0.02%) Total Size: 3.08 MB
ℹ️ View Unchanged
|
ramonjd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…t bail on including the embedded data
5127015 to
ca61178
Compare


What?
Closes: #72612 (this is the last of the dedicated media fields we need to include in this package, though we might want to continue to add to them as feedback comes in for the media modal and media editors).
Add an "Attached to" media field, that corresponds to the attached to/uploaded to behaviour in the existing media library.
Part of:
This is a fairly basic MVP version of how the attached to behaviour could work and is based on work by @ramonjd that we collaborated on in proof of concepts (kudos Ramon!). It currently uses a Combobox for selecting posts, but further down the track we might use a generalised post picker for this sort of control (i.e. what's proposed in #71128). The goal with this PR is to provide a decent enough "floor" for work to progress in follow-ups.
Why?
Being able to attach an image to a post or page is an important part of media handling in WordPress, so the "attached to" relationship should be available wherever we're displaying (or editing) media items.
How?
attached_tofield that usesComboboxandfetchLinkSuggestionsfor its edit stateattached_tofield (not shown by default) and ensure thewp:attached-todata is embedded in requests for media itemsTesting Instructions
npm run storybook:dev) and for the Data Forms Preview, use the panel layout to see how the field will look when it's used in the media editor (roughly)Screenshots or screencast
In the media modal (after enabling the attached to field from the settings dropdown — it's hidden by default)
In Storybook
Quick video of revealing the field
2026-01-08.16.35.18.mp4