[wp-trac] [WordPress Trac] #23063: Add 'UPLOADS_URL' constant to work in tandem with the 'UPLOADS' constant

WordPress Trac noreply at wordpress.org
Sun May 19 15:06:17 UTC 2013


#23063: Add 'UPLOADS_URL' constant to work in tandem with the 'UPLOADS' constant
-------------------------+----------------------
 Reporter:  wesrice      |       Owner:
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  Upload       |     Version:  3.5
 Severity:  normal       |  Resolution:  wontfix
 Keywords:               |
-------------------------+----------------------

Comment (by kadamwhite):

 I may be missing something, but from the code I still feel there's room to
 improve how `wp_upload_dir()` works to handle what is asked here—If I have
 my WordPress install in `server_root/wp/`, but I want images to be
 uploaded to `server_root/files/`, I have to actually manipulate the raw
 `ABSPATH` value in order for `wp_upload_dir()` to correctly parse my
 needs:


 {{{
 if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
         update_option( 'upload_path', untrailingslashit( str_replace(
 'backend', 'files', ABSPATH ) ) );
         update_option( 'upload_url_path', home_url( '/files' ) );
 }
 }}}

 Is this easy to do? Sure—but I feel that there's room to allow for a case
 where your media should be relative to the server root, not `ABSPATH` or
 `WP_CONTENT_URL`.

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


More information about the wp-trac mailing list