DEV Community

Discussion on: Utilising WordPress Media Library for Uploading Files

Collapse
 
niloys7 profile image
Niloy

Hi,
suppose i have #yourButtonID for open the wp media uploader. now i have an attribute (data-id="10") on the trigger button(#yourButtonID).
now, how can I get the attribute into the "select"

// Fires when a user has selected attachment(s) and clicked the select button.
customMediaLibrary.on( 'select', function() {

var selectionCollection = customMediaLibrary.state().get('selection');

} );