Make WordPress Core

#57425 closed defect (bug) (invalid)

Media breaks when changing primary site

Reported by: gadelhas's profile Gadelhas Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: multisite Cc:

Description

We have a network with two websites:

  • site1.com (Main)
  • site2.com

We want to make site2.com the primary one, and after a while delete it.

When you do that by changing the BLOG_ID_CURRENT_SITE to the site2.com ID, the gallery breaks.

All the images there are broken because _wp_upload_dir changes depending on the status of the website has primary.

A quick example in this case:
Simulated result of wp_upload_dir
Before:

  • site1.com - Primary - wp-content/uploads/2023/01
  • site2.com - wp-content/uploads/sites/2/2023/01

After:

  • site1.com - wp-content/uploads/sites/1/2023/01
  • site2.com - Primary - wp-content/uploads/2023/01

This means that when you change the primary site, you can't use old images, and if you have to edit old posts, the images on those could break too.

Change History (2)

This ticket was mentioned in Slack in #core-test by ironprogrammer. View the logs.


21 months ago

#2 @ironprogrammer
21 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hi, @Gadelhas, welcome to WordPress Trac!

I'm sorry you're having issues updating your website. Please note that Core Trac is used for bug reports and enhancements for the WordPress core software, not individual support issues or questions.

Please check out the dedicated support forums for help with your site: https://wordpress.org/support/forums/. You might also find useful multisite info in the support articles, e.g. https://wordpress.org/support/article/multisite-network-administration/.

Note: See TracTickets for help on using tickets.