WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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