[wp-trac] [WordPress Trac] #25650: When switching between blogs, wp_upload_dir 'baseurl' and 'url' may be pointing to the current blog not the switched one

WordPress Trac noreply at wordpress.org
Thu Jun 5 12:19:44 UTC 2025


#25650: When switching between blogs, wp_upload_dir 'baseurl' and 'url' may be
pointing to the current blog not the switched one
--------------------------------------+-----------------------------
 Reporter:  igmoweb                   |       Owner:  ideag
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  Future Release
Component:  Upload                    |     Version:  3.6.1
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  multisite
--------------------------------------+-----------------------------

Comment (by johnjamesjacoby):

 Replying to [comment:31 ideag]:
 > @johnjamesjacoby - do you have any specific suggestions for an alternate
 approach?

 Nothing concrete at the moment.

 Broadly speaking, this bug seems to affect all multisite installs when
 switching between sites where `get_option( 'upload_url_path' )` is empty —
 which, from what I’ve seen, includes all secondary (non-main) sites.

 Perhaps `_wp_upload_dir()` could benefit from a more targeted override in
 those cases, rather than falling back to `WP_CONTENT_URL`?

 > I have explored a way to avoid introducing a new constant here:
 https://core.trac.wordpress.org/ticket/25650#comment:16
 >
 > In my opinion, that solution would be worse than the one using a
 constant.

 I did see that, and I totally agree with you — it’s clever, but doesn’t
 seem like an improvement! 😄

 > I do not see a way to avoid modifying `content_url()`, as that is where
 the actual bug is. If that is a deal breaker, then I would say this is a
 `wontfix` and should just be closed as such.

 Are we certain that’s where the bug lives? 😅

 It’s still reproducible even without calling `content_url()`, and using
 that function doesn’t seem to resolve it either.

 I wouldn’t go so far as to call it a `wontfix` — the issue is very real
 and reproducible. I’m just not fully convinced this is the right fix yet.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/25650#comment:32>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list