Support » Plugins » Hacks » Temporarily Disable save-attachments-compat in 3.5

  • I have a plugin ( ) that uses attachment_fields_to_edit to add a number of fields to video attachments’ details form in order to generate thumbnails and facilitate embedding locally hosted videos. WordPress 3.5 delivered some interesting challenges that I’ve mostly dealt with. However, in the new media modal, every time a user changes something, save-attachments-compat runs via AJAX, the attachment meta is saved and the form is refreshed. This is great, with the exception of a few cases.

    The user can set the number of thumbnails to generate in a text field, then click the “generate” button, which starts the process of generating thumbnails and inserting them into the form. Unfortunately what happens in 3.5 is, let’s say you enter “5” into the text field, then click the “generate” button. Clicking the “generate” button means the text field loses focus and triggers save-attachments-compat, which reloads the whole form and interrupts the thumbnail generating process.

    This is also a problem once the thumbnails are successfully generated because as soon as a thumbnail is selected (via radio button) save-attachments-compat is triggered and all the other thumbnail options disappear. I’d like to give the user an opportunity to change his or her mind.

    I’ve figured out that if I use jQuery to unbind all events from the .compat-item form, I can disable the autosave. What I can’t get my head around is a good way to restore those events. And is there a better way of interrupting the autosave?

    I also have seen hints that there is a new, better way to add fields to the media modal, but I can’t find any specific information about it. If anyone knows more about it, can you point me in the direction of something that will get me started?

  • The topic ‘Temporarily Disable save-attachments-compat in 3.5’ is closed to new replies.