I can change the 'Full URL path to files' (seen in Settings/Media) using the following in functions.php, but although the path is correctly displayed in the Media page it doesn't actually work:
$path = get_bloginfo('template_directory');
$path = $path . '/images';
update_option (upload_url_path , $path );
The only way to change the upload folder and get it working is by using a relative path (seen on the same page 'Store uploads in this folder') by using update_option (upload_path , $path ); in functions.php.
However, I know of no way to get the relative path accurately and consistently either using WP functions or PHP functions (e.g. if sites are set up on subdomains). There is a lot of messy regex and hacky code around but I don't trust any of it to be rock-solid.
Any idea why the full path doesn't work in 'Full URL path to files', or how to accurately get the relative path e.g. to the theme directory?
For a theme I want to release.