最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

multisite - Launch Media Library for specific MU site

programmeradmin0浏览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();

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
Add a comment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论