[wp-trac] [WordPress Trac] #54233: Hardcoded wp-content instead of using WP_CONTENT_DIR

WordPress Trac noreply at wordpress.org
Fri Oct 8 07:11:50 UTC 2021


#54233: Hardcoded wp-content instead of using WP_CONTENT_DIR
--------------------------+-----------------------------
 Reporter:  malthert      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Lots of places have incorrectly hardcoded "wp-content" instead of using
 WP_CONTENT_DIR or
 {{{#!php
 <?php
 str_replace( ABSPATH, '', WP_CONTENT_DIR )
 }}}

 e.g. wp-admin/includes/class-wp-debug-data.php uses it correctly like in
 the above example (the str replace)

 This causes updates for installations that use WP_CONTENT_DIR with
 something else than wp-content to not work correctly, which requires major
 manual work (to clean up those removed files) and is a major bug in my
 opinion.
 Some files it only affects an error message, but in some files it has a
 bigger impact.


 Files where wp-content is hardcoded, but the str replace should be used
 instead: (search for wp-content in those files, should be obvious then)
 /wp-admin/theme-install.php
 /wp-admin/includes/class-wp-site-health.php
 /wp-admin/includes/class-wp-site-health-auto-updates.php
 /wp-admin/includes/class-core-upgrader.php
 /wp-admin/includes/update-core.php (this one is tricky, since the $from
 new version is wp-includes, but the $to is not, so this must be done
 dynamically. Also "wp-includes" is hardcoded there where WPINC should be
 used for $to "wp-includes")
 /wp-includes/media.php (this one needs a bit special handling I can
 provide as snippet if requested)
 /wp-includes/ms-functions.php (wp-content is in an array, however the wp-
 content should be the above str replace)

 If there is a way to submit git pull requests, I'd be happy to. I can also
 just attach the whole, fixed files here if that helps (I just don't know
 have any idea about SVN)

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


More information about the wp-trac mailing list