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:


We have a network with two websites:

  • (Main)

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

When you do that by changing the BLOG_ID_CURRENT_SITE to the 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

  • - Primary - wp-content/uploads/2023/01
  • - wp-content/uploads/sites/2/2023/01


  • - wp-content/uploads/sites/1/2023/01
  • - 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.

17 months ago

#2 @ironprogrammer
17 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: You might also find useful multisite info in the support articles, e.g.

Note: See TracTickets for help on using tickets.