I have a site for a client that I picked up after they left another agency. That agency used a proprietary theme with its own self-hosted page builder that prevents it from being updated or edited on any other hosting environment but theirs.

Another aspect of it is that it remaps the URLs for the theme and upload directories. So, for example, instead of WP looking for the theme files in http://domain.com/wp-content/themes/…. it looks for them in http://domain.com/t/….

Likewise for image uploads, instead of looking for images in http://domain.com/wp-content/uploads/…, it looks for them in http://domain.com/u/….

I recreated the directories at the root level to match the /t/ and /u/ URLs, and that got the site back up and running for the client. However, whenever they upload a new image, it is uploaded into the original /uploads/ location, and while all of the info about the image is in added, the Media Library still looks for the image itself in the /u/ directory (see attached).

enter image description here

I have to solve the problem by going in via FTP and manually copying the image from the /uploads/ directory to the one I created (also attached).

enter image description here

I can't seem to find where this redirect may be happening. Has anyone else had any experience with this?



1 Answer 1


If you add this in the functions.php file in your themes folder:

add_filter('upload_dir', 'new_upload_dir');

function new_upload_dir( $param ){
    $mydir = '/wp-content/uploads';

    $param['path'] = $param['path'] . $mydir;
    $param['url'] = $param['url'] . $mydir;


    return $param;

It should change the directory the images are uploaded into.

  • I don't want to change the upload directory. I want to get rid of the redirect, so that the Media Library looks for the image in the default directory (where the images actually are). But still, thanks, this gives me an idea of what to look for.
    – Ty Morton
    Sep 11, 2017 at 13:20
  • I changed the directory to the uploads directory. I would first look/grep for the upload_dir filter in the theme's function.php file. The theme should be using a similar function to make the change. That would be the best place to make the change if the theme is using a child theme etc... Sep 11, 2017 at 13:25
  • This would just change it back after the theme changed it. Which isn't very efficient. Sep 11, 2017 at 13:26
  • I wasn't able to find anything doing a grep search. That was why I posted the question. I did some more poking around, though, and discovered a url_shortener function that appears to be the culprit. It's heavily distributed throughout the custom theme (intentionally, I'm sure). I'll probably just start over with a new theme for them. Thanks for the assistance!
    – Ty Morton
    Sep 11, 2017 at 16:25

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.