Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

2 Answers 2

up vote 10 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
1  
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
1  
@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
1  
@EugeneManuilov That’s why I remove those per .htaccess. –  toscho Jan 2 '13 at 11:10
2  
@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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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