[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 10:56:43 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):

 Reviewed & refreshed @ideag's PR, by resolving conflicts that arose
 between 2023 and today.

 ----

 I like the simplicity of a new `WP_DYNAMIC_CONTENT_URL` constant, but I
 think it is not ideal.

 * It could be mistakenly set manually (say, via `wp-config.php`)
 introducing a new opportunity for confusion.
 * It introduces a relatively unique problem-solving approach into the core
 codebase.
 * It is only used to simplify this single comparison.

 I'm also worried that changes to `content_url()` may have unforeseen
 consequences. It isn't widely used, but it is an old (2.6.0) relatively
 low-level function.

 ----

 Thinking about the PR more deeply, I think it may not be ''exactly'' the
 right approach yet.

 I've also identified some inconsistencies with where & how the related
 option values are set, I assume for legacy reasons, but have not
 confirmed...
   * `add_network()` sets `upload_path` and `upload_path_url` to ''non-
 empty'' values on the root site.
   * `populate_options()` defaults `upload_path` and `upload_path_url` to
 ''empty'' values.
   * `wp_initialize_site()` sets only `upload_path` to a ''non-empty''
 value.

 At this time, I'd recommend ''not'' committing this PR as-is, and
 researching a different avenue.

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


More information about the wp-trac mailing list