0

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();

1 Answer 1

0

I 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.