WordPress 3.5+, JavaScript, wp.media.editor.open

I’m developing a plugin for WordPress, where I need to create a gallery with images.

In JavaScript I call Media editor to create a gallery, using this code: wp.media.editor.open(btn).

Read More

Editor opens with default “Insert Media” tab. I would like it to open from “Create Gallery” tab. Can you please advise, how to do that?

Related posts

Leave a Reply

1 comment

  1. I think what you are looking for is something like this.

    var gallerysc = "[gallery ids='123,12,10']";
    wp.media
        .gallery
        .edit(gallerysc)
        .on('update', function(g, x) {
    
            console.log(g.models);
        });