In some occasions may be necessary that file uploads URL points to somewhere else different of standard place. This can be done by using the option upload_url_path
.
To change the path http://example.com/wp-content/uploads and let it like http://static.example.com/wp-content/uploads, the option upload_url_path
should be set like below.
update_option(
'upload_url_path',
'http://static.example.com/wp-content/uploads'
);
Reference
- https://developer.wordpress.org/reference/functions/wp_upload_dir/