Request: include post_id on media_send_to_editor filter call in wp_ajax_send_attachment_to_editor
|Reported by:||adrianhardy||Owned by:|
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 $_POSTpost_id? with the "media_send_to_editor" filter?
$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.
Change History (5)
comment:4 @wonderboymusic — 8 months ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release