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.

I am developing a plugin and I changed the upload directory of the v.3.5 media uploader to this: \wp-content\plugins\deixto\cle.

I used the following function and filter:

function deixto_35_upload_dir($path){    
    $path['path'] = plugin_dir_path(__FILE__) . "cle";
    $path['url']  = plugin_dir_url(__FILE__) . "cle";
    $path['basedir'] = plugin_dir_path(__FILE__) . "cle";
    $path['baseurl'] = plugin_dir_url(__FILE__) . "cle";
    return $path;
}
add_filter('upload_dir', 'deixto_35_upload_dir');

When i upload the file, it correctly uploads to the /deixto/cle folder. However, for some reason, its url is set to:

http://127.0.0.1/wp-content/uploads/C:xampphtdocswp-contentpluginsdeixto/cle/file.txt

instead of:

http://127.0.0.1/wp-content/plugins/deixto/cle/file.txt

Obviously $path['path'] changes the directory of the upload. I tested this and it's working. But why when I change $path['url'], the url of the file isn't changing? It just stays the same...

How can i set the url address of the file to http://127.0.0.1/wp-content/plugins/deixto/cle/file.txt ?

share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.