WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As the recent changes in WordPress 3.5 removed the "full URL path to files" option from media library I am wondering how to set this option to a custom path now?

I need to set my "full URL path to files" for my media files to a custom subdomain. Can you guys help me out with finding a solution for this problem?

Regards, faxxim

share|improve this question
Hello I wrote a small plugin for the new facilities Wordpress 3.5. You can directly modify the domain or subdomain wordpress.org/extend/plugins/wp-original-media-path – user25631 Jan 6 '13 at 13:12
up vote 13 down vote accepted

The option name is upload_url_path, and you can still filter it:

add_filter( 'pre_option_upload_url_path', 'wpse_77960_upload_url' );

function wpse_77960_upload_url()
    return 'http://subdomain.example.com/files';
share|improve this answer
remove trailing slash because you will have double slashes in the url, like 'http://subdomain.example.com/files//path/to/image.jpg' – Eugene Manuilov Jan 2 '13 at 10:55
OK, good to know its that easy! Thank you very much! – faxxim Jan 2 '13 at 10:58
@toscho I know that it will work, but it is not feng shui to have double slashes :) – Eugene Manuilov Jan 2 '13 at 11:07
@EugeneManuilov That’s why I remove those per .htaccess. – toscho Jan 2 '13 at 11:10
@bueltge UPLOADS is a file path, upload_url is an URL. Two different URLs can point to the same local path, and there is no way to determine the correct URL for a given path. So both are two different things. – toscho Jan 28 '13 at 16:46

Thank you @Toscho for providing me with the name of the option. Here's another way to change it, by placing this in your functions.php file:

update_option('upload_url_path', '/wp-content/uploads');

This will make WordPress embed images like src="/wp-content/uploads/file.jpg" instead of src="http://domain.com/wp-content/uploads/file.jpg"

share|improve this answer

protected by toscho Aug 12 '14 at 15:40

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.