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/ ?


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


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: