0

I cannot find the answer on how to open the media gallery with the create/edit gallery view. I can open the media library with multiple image selection, sure. But i actually want the gallery view / flow as seen in the block type gallery.

The gallery flow has an action "create gallery" if none has been created before or "add to gallery" otherwise, where you can select multiple images with one click and confirm. It also has an action "edit gallery" where an existing gallery can be edited, which means reordering or removing items.

I tried to read the source code starting with the gallery block, but still could not figure out the answer. Also google did not give me an answer as they are outdated.

0

The question is a few months old but still can help someone.

To open the media uploader to the "edit gallery" view, you just have to set the state to "gallery-edit" like this :

media_uploader = wp.media({
    frame:    "post",
    state:    "gallery-edit", // here
    multiple: true,
    editing:  true,
});

For now, I still can't figure out how to set a default selected gallery on the opening, when you want to edit a gallery already created. If someone knows how to do this. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.