Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#10917 closed defect (bug) (fixed)

Uploads are not attached to a post when created using QuickPress

Reported by: iwords Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.8.4
Component: Media Keywords: has-patch
Focuses: Cc:


It is impossible to attach a file or image to a post created using QuickPress on the Dashboard.

Since QuickPress doesn't have an autosave feature like the full-blown editor, a post ID isn't generated until the post is either saved or published - at which point the post's content is cleared from the QuickPress editor, so you can no longer attach a file to it anyway.

Currently, the only way to attach a file or image to a post written in QuickPress is to save it as a draft, then re-edit it using the full editor, which somewhat defeats the object of using QuickPress.

Just to clarify - you can upload images and insert them into the *body* of the post, but you can't upload images and have them stored as attachments using QuickPress at all.

Note: #8932 appears to report a similar issue, but was marked as a duplicate of #9471. I added my feedback to #9471 but was asked to open a new ticket.

Attachments (5)

10917.patch (3.2 KB) - added by ocean90 4 years ago.
10917.2.patch (3.9 KB) - added by ocean90 4 years ago.
This will remove the 'View all' button after saving as draft too.
10917-ajax.patch (5.9 KB) - added by ocean90 4 years ago.
Make it Ajax
10917-ajax+transient.patch (6.5 KB) - added by ocean90 4 years ago.
Transient API
10917-ajax+useroption.patch (6.6 KB) - added by ocean90 4 years ago.
With *_user_option

Download all attachments as: .zip

Change History (18)

comment:1 follow-up: nacin4 years ago

Is this still current?

comment:2 in reply to: ↑ 1 blepoxp4 years ago

Replying to nacin:

Is this still current?

I've confirmed this is still not working correctly. I'll look at it tonight or tomorrow.

comment:3 nacin4 years ago

  • Milestone changed from Unassigned to 3.0

Closing #13277 as a duplicate.

comment:4 ocean904 years ago

  • Keywords has-patch added

10917.patch solves the problem. We create now an auto-draft and as a result we get an ID which we can use for get_upload_iframe_src().

ocean904 years ago

ocean904 years ago

This will remove the 'View all' button after saving as draft too.

ocean904 years ago

Make it Ajax

comment:5 ocean904 years ago

Do prevent that on each site load a new post_ID will be generated, I had the idea, to ajaxify the qickpress box.
If the box is closed or not activated there will be no new post_ID. If it's open there will be a new post_ID (auto-draft) and attachments works fine.

comment:6 ocean904 years ago

Another option would be to save the post_ID as Transient, maybe for one day. If the auto-draft still exists use this otherwise create a new one.

comment:7 ocean904 years ago

  • Keywords ui-feedback added

nacin and I want to have some UI feedback:
At the moment we use div.message (screen) for the status message. I would like to change it to div.updated (screen).

comment:8 johnonolan4 years ago

Absolutely, massive +1.

ocean904 years ago

Transient API

comment:9 ocean904 years ago

  • Keywords ui-feedback removed

Added a patch which uses the Transient API to store the post_ID of the auto-draft. For example for two days.

comment:10 westi4 years ago

Patch looks interesting but is not multi-user safe.

I think you need to key the transient on something user specific as well as otherwise two users will end up playing with the same draft if your not careful.

comment:11 ocean904 years ago

Oh, that's right. So instead of the transient we can save the id as an user option. So each user has now an own quick press auto-draft for maximal 7 days and also we didn't need to delete the post_id like I did it with transient.

ocean904 years ago

With *_user_option

comment:12 westi4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [14815]) Ensure that QuickPress media uploads get attached to the auto-draft we create for new posts correctly. Fixes #10917 props ocean90.

comment:13 nacin3 years ago

(In [17743]) Don't load the QuickPress widget via XHR. see #16927. Reverts [16725] as it's no longer needed. Reverts part of [14815], which introduced the behavior, see #10917.

Note: See TracTickets for help on using tickets.