On my custom tab, I copied media-form from media_upload_gallery_form, only changed form id and action-url to reflect my tab's name. The form displayed as expected, but after click "Save All Changes", the post data is not saved. Please note unlike custom fields that we add filter to "attachment_field_save", this time it is the entire media-form. It can be saved on either Gallery tab or Library tab, so I guess there has to be a way to be saved on my custom tab?
1 Answer
Just figured out this one-- in the function that load the iframe, add this:
if ( !empty($_POST) ) {
$return = media_upload_form_handler();
if ( is_string($return) )
return $return;
if ( is_array($return) )
$errors = $return;
}
Then, all the form data get saved as normal.