Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In WordPress 3.5 I was able to open a Media Manager popup with a set of pre-selected items from the Media Library using the following piece of code:

frame.on(‘open’, function(){
    var attachment = wp.media.attachment( 7 );

    frame.state().get('selection').add( attachment );

For some reason, this does not work on WordPress 3.6-beta as it seems like the the selection system has changed, as per this commit (see the changelog).

After a few logs to the browser’s console, I’ve come to the conclusion that the selection is indeed not empty (I can see the preview of the supposedly selected image on the frame’s right), yet the picture thumbnail isn’t visually highlighted on the left part of the frame (with the usual turquoise border).

Has anyone encountered this issue as well? Could someone please tell me what I’m doing wrong here, or at least point in a direction where I could find the solution to this problem?

Many thanks!

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.