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

javascript - Uppload image from another source wp.media

programmeradmin1浏览0评论

I am writing an extension that will load images from third party sources and embed that image in WP media library.

I cannot figure out how to manage wp.media to load such images.

How it will work. When the user opens the media library, he will have an additional download button from BrandFolder By clicking on the button, we will get its catalog of images by api. Having selected the necessary picture, we can get its url, using php we can download this picture and create a post of the attachment type.

And now we have the attachment ID, but how do we now insert it into the media library without reloading the page and then switch the tab to the Media Library tab?

I think such a flow would be suitable

  1. Choose a picture
  2. Load the picture and create a post type attachment
  3. After that, at the front, using wp.media, switch the active tab to Media Library
  4. Reload the content of the Media library tab

But how 3 and 4 points I can’t figure out, can someone help me with this?

发布评论

评论列表(0)

  1. 暂无评论