0

I have a site I'm working on and when it was developed they had all the media uploads go to folder called /assets/ in the root of the WP install. This is being done via: define('UPLOADS', 'assets'); in the wp-config.php file.

This site is is probably 5 years old and has hundreds or more of images there.

What I'm trying to do is remove the uploads definition so that all uploads go in the /wp-content/uploads/ directory where they should have from the beginning. One major reason for doing this is they want to use a plugin called WP Stagecoach, but the plugin won't work with a custom uploads directory.

If I comment out the define('UPLOADS', 'assets'); all the images on the site disappear, even though the image paths are unchanged. And they show up as blank images in the media library.

So...I'm hoping to do one of two things:

  1. Leave existing images in the assets directory and have newly uploaded images go to the wp-content/uploads directory and have all images appear on both the front-end and the media library. But not sure if this is a possibility.
  2. Move all the existing images from the assets folder to the wp-content/uploads directory. I know this would most likely require the image URLs to be updated in the DB.

I'm just not sure the best way to approach this. Any advice would be greatly appreciated.

  • Do you have access to htaccess? If so, perhaps you could remove that constant, and set a RewriteRule in htaccess for the old URLs. – vancoder May 18 at 16:53
1

Thanks for the response @jxxe.

So I ended up figuring out how to do what I needed to do. For anyone else who might be needing the same thing, here's what I did.

  1. Downloaded /assets/ directory via SFTP
  2. Commented out define('UPLOADS', 'assets'); in wp-config.php
  3. Uploaded contents of assets to /wp-content/uploads/ via SFTP

Surprisingly, I didn't even have to update anything in the DB for everything to start working correctly. All the images on the front end and the media library showed and the file path updated on its own to use the uploads folder. However, I did use Better Search Replace plugin to globally change all instances of /assets/ to /wp-content/uploads/ in the DB for good measure.

| improve this answer | |
0

This plugin should help. You will probably have to manually move the files into the WordPress filesystem and sort them into the correct folders.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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