bueltge / multisite-global-media

Share a media library across the WordPress Multisite network
GNU General Public License v2.0
215 stars 50 forks source link

Global Media as a Featured Image and REST API with ?_embed #109

Closed goaround closed 4 years ago

goaround commented 4 years ago

Hi,

First of all Multisite Global Media works with the REST API and ?_embed (https://developer.wordpress.org/rest-api/using-the-rest-api/global-parameters/#_embed), which includes the featured image in the response.

But the problem I run in is that after a post with a featured image from the global media, no other post contains a _embedded featured image any more.

Steps reproduce:

  1. Create a multisite with at least two sites
  2. Upload an image to the site with the ID 1
  3. Create two posts on site 2. The newest post should contain the featured image from the global media. The older one should contain a featured image from the sites media.
  4. Check the response from /wp-json/wp/v2/posts?_embed. The _embeddedobject is completely missing at the 2. post
goaround commented 4 years ago

I just discoverd the bug. There is a $this->siteSwitcher->restoreBlog(); missing. I submitted a pull request: https://github.com/bueltge/multisite-global-media/pull/110

bueltge commented 4 years ago

Thanks for the issue, description and the pull request #110 for fixing this topic.