[wp-trac] [WordPress Trac] #22641: Request: include post_id on media_send_to_editor filter call in wp_ajax_send_attachment_to_editor

WordPress Trac noreply at wordpress.org
Thu Nov 29 20:44:59 UTC 2012


#22641: Request: include post_id on media_send_to_editor filter call in
wp_ajax_send_attachment_to_editor
-----------------------------+-------------------------
 Reporter:  adrianhardy      |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Media
  Version:  trunk            |   Severity:  minor
 Keywords:                   |
-----------------------------+-------------------------
 Before 3.5, by combining some hidden fields on the add media popup (using
 attachment_fields_to_edit) and then looking for those fields in
 $attachment in the media_send_to_editor filter, you could alter the $html
 sent back to the editor on a per custom post type basis.

 Here's a pre 3.5 tutorial on what I'm on about: http://shibashake.com
 /wordpress-theme/how-to-hook-into-the-media-upload-popup-interface - The
 relevant part is in step 4, "Set Our Own Action".

 Because recent changes mean that the fields added by
 attachment_fields_to_edit are posted separately ("save-attachment-
 compat"), there's no way to identify the custom post type when hooking
 into the media_send_to_editor filter.

 In wp_ajax_send_attachment_to_editor(), is there any reason we couldn't
 also include $_POST['post_id'] with the "media_send_to_editor" filter?

 e.g.

 {{{
 $html = apply_filters( 'media_send_to_editor', $html, $id, $attachment,
 $_POST['post_id']);
 }}}

 I'm new to WP, but I would've thought that wouldn't break anything because
 of the way most filter hooks will only look for params 1-3.

 Thanks,

 Adrian

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22641>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list