Happy New year!

So I am having a big of a problem, currently one of our php files that we bought points to the default uploads directory for wordpress and we would like to change this to our own uploads directory.

We are still using the default uploads directory for wordpress but we want to change the directory where this custom php file uploads to.

Currently the code looks like this:

$upload_dir = wp_upload_dir();

It currently looks like this "www.example.com/wp-content/uploads/downloads/encrypted/"

We want it to point to "www.example.com/downloads/encrypted/"

Have looked into the arrays for wp_upload_dir(); but cannot seem to go a folder back. Any tips or help?


  • Hook into said custom file or as last resort just edit it?
    – Rarst
    Commented Dec 31, 2013 at 0:57
  • Hi Rarst, I would like to edit the file but edit it to what? I tired to edit it to $url = site_url (); and nothing happened.
    – Lilap
    Commented Jan 1, 2014 at 1:54

2 Answers 2


try this way:

function wp128084_upload_dir( $pathdata ) {
     // change path here
     return $pathdata;

add_filter('upload_dir', 'wp128084_upload_dir');

add this where you want to change upload directory then again remove filter to change to default wordpress directory

remove_filter('upload_dir', 'wp128084_upload_dir');

You need to define UPLOADS constant.

Add the following line in your wp-config.php file

define( 'UPLOADS', ''.'downloads/encrypted' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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