admin管理员组文章数量:1379636
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:
- 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.
- 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.
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:
- 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.
- 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.
Share Improve this question asked May 18, 2020 at 15:43 Jonathan Ryan PattersonJonathan Ryan Patterson 341 silver badge6 bronze badges 1- 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 Commented May 18, 2020 at 16:53
2 Answers
Reset to default 1Thanks 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.
- Downloaded /assets/ directory via SFTP
- Commented out
define('UPLOADS', 'assets');
in wp-config.php - 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.
This plugin should help. You will probably have to manually move the files into the WordPress filesystem and sort them into the correct folders.
本文标签: Moving Existing images from custom directory to WP39s upload directory
版权声明:本文标题:Moving Existing images from custom directory to WP's upload directory 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744461778a2607276.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论