#12639 closed defect (bug) (fixed)
upload_url_path is always overwritten in function wp_upload_dir
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | 3.0 |
| Component: | Upload | Version: | 3.0 |
| Severity: | major | Keywords: | |
| Cc: |
Description
I need to have a custom upload_path and upload_url_path so that uploads are served from a separate dedicated server. The problem is that the file URL is always being overwritten by a URL that points to a subdirectory under my main wordpress install.
I tracked down the problem to the following code within the wp_upload_dir function of wp-includes/functions.php:
if ( defined('UPLOADS') && ( WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) ) {
$dir = ABSPATH . UPLOADS;
$url = trailingslashit( $siteurl ) . UPLOADS;
}
Because I have an $upload_path defined this conditional is always trigged and the $url is overwitten when I want it to keep it as get_option( 'upload_url_path' )
Change History (3)
- Resolution set to fixed
- Status changed from new to closed
I think fixes for #12549 address most of this. For MU setups it is customary to make path customizations via the UPLOADS constant.
I'm not really following how I can define UPLOADS to be a path completely outside of the Wordpress install with $dir = ABSPATH . UPLOADS;
That puts it right back under the Wordpress install.
Also I don't see how to have the upload_url point to a different server with $url = trailingslashit( $siteurl ) . UPLOADS;
What am I missing here and how can the UPLOADS constant help me around that?

xref #12549