Media library not loading after switching the main site of multisite

I switched the subsite and main site of a multisite. Now, the images are not loading in the media library and posts of the main site. However other subsites are working fine.

The images of the new main site are still available in their old directory. domain.com/wp-content/uploads/sites/2/image-title/
However, the image urls of the media library and thumbnails are domain.com/wp-content/uploads/image-title/

To fix this, I run wp search-replace on wp_postmeta and wp_posts to change domain.com/wp-content/uploads/sites/2/ with domain.com/wp-content/uploads/

That didn’t help.

1/Where should the images of the main site be after switching main site? In /wp-content/uploads/ or in wp-content/uploads/sites/2/

2/Can I or should I manually move images from /wp-content/uploads/sites/2/ into the appropriate year/month folder in wp-content/uploads/ ?

Thanks.

Read more here: Media library not loading after switching the main site of multisite

Leave a Reply

Your email address will not be published. Required fields are marked *