WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#22588 closed defect (bug) (fixed)

Back compat $_REQUEST['post_id'] for media XHR requests

Reported by: nacin Owned by: ryan
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch commit
Focuses: Cc:

Description (last modified by nacin)

query-attachments, save-attachments, and save-attachments-compat should all pass back 'post_id', for consistency with the old media-upload.php dialog, as plugins may be doing $_REQUEST['post_id'] checks in conjunction with parse_query, save_post, attachment_fields_to_save, or other filters.

We should consider also calling set_current_screen( 'media-upload' ) for these three requests, or for at least query-attachments, to allow the current screen object to be accurate. It's kind of hacky, and doesn't handle $pagenow, but it is something to consider.

Attachments (3)

22588.diff (4.6 KB) - added by koopersmith 7 years ago.
22588.2.diff (2.3 KB) - added by koopersmith 7 years ago.
22588.3.diff (3.0 KB) - added by nacin 7 years ago.
Refreshed to add post_id to send-link-to-editor too.

Download all attachments as: .zip

Change History (12)

#1 @nacin
7 years ago

  • Description modified (diff)

@koopersmith
7 years ago

#2 @koopersmith
7 years ago

  • Keywords has-patch added

Patch adds support for $_REQUEST['post_id'] in all media ajax requests.

#3 @koopersmith
7 years ago

  • Keywords needs-patch added; has-patch removed

Ignore that. Parts of the patch confuse the post ID we're acting on with the post ID context (the post we're editing while we perform the action).

#4 @Chouby
7 years ago

  • Cc frederic.demarle@… added

@koopersmith
7 years ago

#5 @koopersmith
7 years ago

  • Keywords has-patch added; needs-patch removed

Let's try this again.

#6 @nacin
7 years ago

Untested, but that looks lovely.

#7 @nacin
7 years ago

#22582 was marked as a duplicate.

@nacin
7 years ago

Refreshed to add post_id to send-link-to-editor too.

#8 @nacin
7 years ago

  • Keywords commit added

Tested before and after, logging the ajax requests. Looks good.

#9 @ryan
7 years ago

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

In 22865:

Back compat $_REQUESTpost_id? for media XHR requests.

Props koopersmith, nacin.
fixes #22588

Note: See TracTickets for help on using tickets.