[wp-trac] [WordPress Trac] #37743: Setting UPLOADS constant's path prefixes the path with ABSPATH instead of WP_CONTENT_DIR

WordPress Trac noreply at wordpress.org
Fri Aug 19 23:26:33 UTC 2016


#37743: Setting UPLOADS constant's path prefixes the path with ABSPATH instead of
WP_CONTENT_DIR
--------------------------+-----------------------------
 Reporter:  jtwebb        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.6
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 On line 1921 if wp-includes/functions.php the base path of the $dir
 variable is WP_CONTENT_DIR. But if you set the UPLOADS constant, then the
 prefixing path is ABSPATH (line 1941).

 This works fine if your uploads directory is in the ABSPATH directory. But
 if you have the WordPress source in a different directory than your
 content, you can't set the path appropriately.

 Use case:
 WordPress source lives in a 'src' directory.
 WordPress content (plugins, themes, uploads) live in 'app' directory, a
 sibling of 'src'
 You want to rename the uploads directory to 'media' or something more
 semantic to what you're using it for.

 The way wp-includes/functions.php is setup now, getting the above scenario
 is impossible unless someone hacks the core.

 Suggested fix: Don't prefix the UPLOADS constant with anything. Allow the
 user to set the root path.

 That would mean changing line 1941 from
 {{{ $dir = ABSPATH . UPLOADS; }}}
 to
 {{{ $dir = UPLOADS; }}}

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


More information about the wp-trac mailing list