[wp-trac] [WordPress Trac] #18489: Create constants in default-constants.php for the uploads folder to allow better custom uploads location

WordPress Trac noreply at wordpress.org
Tue Jun 4 16:41:23 UTC 2013


#18489: Create constants in default-constants.php for the uploads folder to allow
better custom uploads location
-----------------------------+------------------------------
 Reporter:  eddiemoya        |       Owner:  eddiemoya
     Type:  enhancement      |      Status:  reopened
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  General          |     Version:  3.2.1
 Severity:  normal           |  Resolution:
 Keywords:  has-patch close  |
-----------------------------+------------------------------
Changes (by creativeinfusion):

 * cc: wptrac@… (added)


Comment:

 Using a constant to do this will suffer from the same problem limitation
 as WP_CONTENT_URL, WP_PLUGINS_URL and WPMU_PLUGINS_URL.  Namely for a
 subsite in a multisite subdirectory install where WordPress has its own
 directory - it won't be possible to reliably set WP_UPLOADS_URL in wp-
 config.php to !http://domain.com/any-user-subsite/somewhere/custom-upload
 and know that any-user-subsite really is a valid subsite, i.e. if the page
 loaded is !http://domain.com/a-page/a-child-page/ the upload url wanted
 would be !http://domain.com/somewhere/custom-upload, but if the page
 loaded is !http://domain.com/any-user-subsite/a-page/ the upload url
 wanted would be !http://domain.com/any-user-subsite/somewhere/custom-
 upload

 UPLOADS as it is doesn't cut it, and the per site options aren't
 appropriate for multisite users; but config constants generally are pain
 in the neck - they should never be directly used by developers but are.
 There's various functions like contents_url, plugins_url and wp_upload_dir
 that give a lot more flexibility as they're filtered, but anything that
 uses constants directly just bypasses any filters applied.

 I actually use the same idea as WP_UPLOAD_xxx at present together with
 filters on all the above functions to inject the user subsites into the
 config URLs, but I'd much rather see constants replaced with something
 that can't be accessed directly and that allows filters to be applied to
 config URLs in particular.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/18489#comment:22>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list