[wp-trac] [WordPress Trac] #57425: Media breaks when changing primary site

WordPress Trac noreply at wordpress.org
Thu Jan 5 17:57:29 UTC 2023


#57425: Media breaks when changing primary site
--------------------------+-----------------------------
 Reporter:  Gadelhas      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:  multisite     |
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57425>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list