I have a form on my front end that I'd like to call a media library modal, but I want the library accessed to be a specific MU subsite.
I trued to switch_to_blog around the wp_enqueue_media function, but it is not pulling the media from the targeted site.
Is there a way to achieve this? I don't see a setting the jquery call to initiate the modal but maybe I missed it?
switch_to_blog( 2 );
wp_enqueue_media();
restore_current_blog();
I have a form on my front end that I'd like to call a media library modal, but I want the library accessed to be a specific MU subsite.
I trued to switch_to_blog around the wp_enqueue_media function, but it is not pulling the media from the targeted site.
Is there a way to achieve this? I don't see a setting the jquery call to initiate the modal but maybe I missed it?
switch_to_blog( 2 );
wp_enqueue_media();
restore_current_blog();
Share
Improve this question
asked Jan 23, 2022 at 4:59
Picard102Picard102
9331 gold badge10 silver badges23 bronze badges
1 Answer
Reset to default 0I asked this in the WP Contributors Slack and was pointed towards this code that allows you to specify the ID of the media library you want to pull from.
https://github.com/humanmade/network-media-library
This doesn't exactly do what I want, it sets a single media library for everysite to use, rather than a specific site on command.