Opened 6 months ago
Closed 6 months ago
#22673 closed defect (bug) (fixed)
QuickPress: Media modal doesn't use the new post id when a post is published
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.5 |
| Component: | Media | Version: | 3.5 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: |
Description
- Upload and insert an image to QuickPress
- Save/publish the post
- Open the media modal again
- Go to the library and select "Uploaded to this post"
It should be empty, but still contains the old image. Also new uploads will be attached to the old post.
Do we have a "render new media modal" method which we can fire on a new QuickPress rendering?
Attachments (2)
Change History (7)
comment:2
koopersmith — 6 months ago
This isn't going to be enough, we're also going to need to change the corresponding update nonce.
comment:3
miqrogroove — 6 months ago
Possibly relevant: If you upload an image, abandon the post, and then return to QuickPress later, the same ID and Auto Draft are in play. Then, if you upload an image and save or publish the new draft, it will have two attachments.
koopersmith — 6 months ago
comment:4
koopersmith — 6 months ago
- Keywords has-patch needs-testing added; needs-patch removed
Patches refresh all of the global post-related JS variables when QuickPress publishes a post, then recreates the modal, and makes sure anything involving post IDs is dynamic.

The templates are designed to be post-agnostic on render precisely for situations like this.
So I suppose we need to set media.view.settings.postId on the fly. This value also gets copied over to media.model.