0

I'm adding a custom attachment field to the media uploader using WordPress' "attachment_fields_to_edit" and "attachment_fields_to_save" filters, which works fine initially after uploading an image (within the modal uploader window). Selecting an option correctly triggers an ajax request and calls my filter function to save meta data for the attachment.

screenshot - shows up here

However, after selecting a value for that field, and then click away to another image in the library and come back to that image, the field is no longer there.

screenshot - where'd it go?

I'm guessing this has something to do with how WordPress' new backbone-based media JS loads the view for each attachment, but it seems wrong.

From what I've been able to find online (which isn't much) the 3.5 media manager is supposed to be compatible with the filters I'm using. Is there a different filter I should be using, or multiple filters, or is this a bug that I need to post on trac?

1 Answer 1

0

I figured it out. In an effort to organize/optimize my actions and filters, there are a bunch that I only call on certain pages, using WordPress' global $pagenow variable. I was only calling the "attachment_fields_to_edit" filter for media-upload.php, async-upload.php, and media-new.php, which apparently isn't a valid way to do this with the new uploader.

I switched to adding the filter on all admin pages and it's working fine now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.