Support » Plugins » Hooking into the new Media Manager window

  • On several themes I build, I need to have fields that take an attachment id, and can be populated by using the media uploader and “inserting” the selected media. I have a decent solution for the moment that does the trick, but now that we have this new Media Manager, I was wondering if there’s a way to hook into it?

    I’ve tried adding custom .insert-media links with the data-editor attribute set to the id of a normal text field, but I can’t seem to get it to work; It just get’s inserted into the mceEditor.

    The closest I’ve gotten is to have the click recreate the window.send_to_editor function, and have it unset itself when it’s done. But, I don’t know how to detect when the media manager is closed without inserting anything and have it unset itself then too.

    function setup_send_to_editor(e){
    	//Temporarily assign a function to window.send_to_editor
    	window.send_to_editor = function(h){
    		//Do stuff
    		window.send_to_editor = false;
    	$('body').on('click', '.custom-insert-media', setup_send_to_editor);


    Actually, I can fix that last issue by just adding a click even to the normal .insert-media button so it clears before loading the media manager for a post. Still, I’m hoping there’s a cleaner way of hooking into the manager, for setting up stuff like additional post thumbnail type metaboxes or a section to add multiple images for the purpose of a carousel; separate from the content.

Viewing 1 replies (of 1 total)
  • I am also currently looking into this issue.

    Wondering, that data-editor does not seem to have any effect.

Viewing 1 replies (of 1 total)
  • The topic ‘Hooking into the new Media Manager window’ is closed to new replies.