Show only images and videos in a window

I’m using the following JS code to open a window to allow users to select images and videos for a gallery. Everything is working, but I’m unable to restrict the window to show images and videos only, it’s showing everything.

Any ideas on what might be wrong?

Thanks in advance


$( '#add_item' ).on( 'click', function( e ) {
    var $el = $( this );


    // If the media frame already exists, reopen it.
    if ( items_frame ) {;

    // Create the media frame.
    items_frame = ={
        title: 'Add to Gallery',
        button: {
            text: 'Select'
        states: [
                title: 'Add to Gallery',
                filterable: 'all',
                type: ['image', 'video'],
                multiple: true

    // Finally, open the modal.;


Read more here: Show only images and videos in a window

Leave a Reply

Your email address will not be published. Required fields are marked *