I added few custom fields via attachment_fields_to_edit
and would like to show them only when certain theme or page builder image option opens the wp.media.iframe
.
Currently they are visible regardless what button opens the uploader for example post "Add media" would not have any use for this option
So I am kinda trying to find a "hook" that would let me know what option is currently using the uploader.
What I am trying to stay away from is doc click events
$(document).on("click", '.some-button-class', function() {
// .some-button-class is clicked
});
and would rather use something like this if possible,
wp.media.frame.on( 'open', function(el) {
// some-button-class has opened
});
Is there a way to do this?