Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to build a simple reusable plugin for image presentation in Wordpress 3.9, and it seems I've hit a brick wall.

I would like to be able to add a couple of options to the instance of the image. (The details under "Attachment Display Settings"). Like a checkbox that says "Responsive" that disables (grays out) the image size dropdown, or options for fixed page positions etc.

In the Media Manager when selecting / replacing an image, I've been able to add some custom fields by use of attachment_fields_to_edit and it's sibling filters, however these fields attach to the image itself (or the image attachment post object if you will), so if I had two instances of the same image on a page, they would share the same value of my custom field.

The wordpress replace image screen, annotated.

a) The Custom Text field I've added, I'm unable to attach this to the instance, all instances of the same image share this value.

b) This is the area where I would like to add options, as everything in here seems to follow each instance.

The Wordpress image details screen, annotated.

c) This shows the same display settings as in the previous screen, however it's presented different when clicking the "pencil" on top of an image in Wordpress 3.9. Notice how the custom options given by attachment_fields_to_edit are not present on this screen at all.

Even though I haven't gotten my head fully around how backbone works, or what the best practices for modifying the wp.media objects are, I'm fairly competent with both php, js and googling for answers. But this one has had me stumped for a few days now, so any help is appreciated greatly.

Thanks for reading!

share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.