Change URLs for static content

This answer has solved the problem.

You need to add this to your functions.php file.

/**
* Custom media upload URL
* @link https://wordpress.stackexchange.com/questions/77960/wordpress-3-5-setting-custom-full-url-path-to-files-in-the-media-library
*/
add_filter( 'pre_option_upload_url_path', 'upload_url' );

function upload_url() {
    return 'http://static.yourdomain.com/wp-content/uploads';
}

There’s no need to add the original snippet to wp-config.php.

Leave a Comment