This is an issue coming up while creating a plugin. I want to add a tab to the wp.media.view.MediaFrame.Select
modal or if a general approach helps:
In the customizer I want to hook in any modal that comes up using wp.media just to add an
alert()
for example.
This is almost it and I am already stuck in tracing what builds those modals and how to hook in.
What I see is:
wp.media().frame.on('open', ...)
can not be used as the frame only exists after clicking a button.- Fallback may be to rewrite
wp.media()
but that doesn’t sound like a sane solution.
What I don’t want is:
- “Use
media_upload_tabs
ormedia_upload_tab_slug
” because such PHP is not respected in the customizer. - “Hook in every button and handle the click”
- “Look for frames via window.Timeout every second”
- Hacky solutions are welcome to find out what is possible but won’t help as THE solution.
Thanks in advance to all wp.media experts here! 🙂