I created a customized wp_view similar to embed (see wp-includes/js/mce-view.js, l. 868). I also have my own tab in the "add media" dialog. Naturally I want the edit button of my wp_view opening the add media dialog with the right tab.

Currently I use this:

edit: function(text, update) {
    tb_show('Some headline', 'media-upload.php?tab=mytab&someparams='+somevalues+'&TB_iframe=true');

I works like a charm, but

  • the edit and delete buttons keep staying in foreground, even before the thickbox.
  • in the codex is written:

    As of WordPress 3.5, the "Media" button for WordPress's post editor no longer utilizes ThickBox, but instead uses a custom Javascript modal.

So I really would prefer to use this custom modal. Is anyone able to explain me how to open the add media dialog it in a certain state (means tab)?

1 Answer 1


Suppose you want to open the modal to the create gallery section:

var options = {
frame: 'post',
       state: 'gallery',
       title: wp.media.view.l10n.createGalleryTitle,
       multiple: true

var frame = wp.media.editor.open(null,options)

If you want something else, I suggest you search through the core js source to change the Library ID as appropriate for the section you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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