Strange media behaviour when migrating single website into wordpress multisite

11 views Asked by At

I have a wp subdomain multisite, that hosts different domains. So for example: example.com, anotherexample.com etc.

Now i want to move a single website from lets say yetanotherexample.com into the multisite. I use the standard wordpress export importer and that works fine. I have most of the data and the media library imported and it is all ok, except that the site is not displaying the images correctly frontend, because the media files are in a slightly different location (wp-content/uploads/sites/{site_id*}/) instead of (wp-content/uploads).

So i do a search and replace in the database for all urls containing wp-content/uploads/ to wp-content/uploads/sites/{site_id}/. But because some paths are escaped, i replace as well wp-content\/uploads\/ by wp-content\/uploads\/sites\/{site_id}.

If i do this, the site is being displayed correctly, however the media files become corrupted in the media library. The meta data such as filesize is not loaded anymore and if i have woocommerce products, the featured image is not displayed anymore, neither can i select the current images. I have to reupload them. Does anybody know why this is?

  • site_id = the id of the site in the network
0

There are 0 answers