jQuery

now browsing by category

 

(WordPress) How to handle multiple instance of “send_to_editor” js function

WordPress built-in media uploader is a great library for uploading media. We can create a upload popup instance for upload media or select media from media library by following way:

After upload done we can get the media URL clicking on “Insert into..” button which actually calls “send_to_editor” function that receives media link as argument. So we can write following code to set image URL in a textbox.

It normally works when you have only one instance like bellow:

send_to_editor_screenshot_1

But what will happen for following scenario where we have two or more custom field area that needs to upload media and insert it into the texfield or container specified?

send_to_editor_screenshot_2
Read More