• Resolved dan

    (@daniel-berhane)


    Hello,

    It is a subdirectory based multisite (no subdomains) and I moved one of the subsites to become the main site. I followed the instructions by Mika Epstein on this article to the letter.

    Now the images of the new main site are acting strange.

    On image library, image links are broken. The permalinks and file urls of images in the media library don’t work.

    However, the images are still embeded inside posts pointing to their old address. /wp-content/uploads/site/2/

    I might be able to use search and replace to strip the /site/2/ part from the image urls. But how could I move several years of images from wp-content/uploads/site/2/ to wp-content/uploads/ folder?

    Note:
    * I had disabled all plugins with potential multisite functionality during the switch to avoid conflicts.
    * I never changed anything on the network settings upload url path and the like. (Except the changes I made today as per Mika’s instructions). Those spaces are still blank.

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter dan

    (@daniel-berhane)

    UPDATE

    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.

    I am wondering whether the images of the new main site are supposed to be after switching main site? In /wp-content/uploads/ or in wp-content/uploads/sites/2?

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

    Thread Starter dan

    (@daniel-berhane)

    Good question Daniel.

    It appears the image files don’t follow the post content when you moved site-2 into becoming the main site.

    Why would they!
    They have different permalink structures from posts and pages.

    Therefore, you will have to do a few more things:
    -> search and replace the image urls in the database
    -> Then move the image files from wp-content/uploads/site/2/ to wp-content/uploads/.

    Perhaps, a shortcut?
    I suspect it might be possible to use a shortcut.
    Just go to the main site’s settings. On the upload path space (which is normally blank), specify the old path as the upload path.
    This way, the new main site might continue to serve images from site-2 folder. And you wouldn’t need to update image urls or move images.

    The shortcut method is not tested. So, if it breaks your site, I am not responsible. But if it works, I hold the patent and expect royalty fees.

    ________
    Just answering my own questions. Why not. ??

    • This reply was modified 7 years, 7 months ago by dan.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Image library broke after switching main site of a multisite’ is closed to new replies.