Hosting Mautic QuickStart -50% with support in Spanish
24 hours and free training
Send up to 1,000,000 emails/year. Mautic support in Spanish 24 hours, 365 days
Has it ever happened to you that after a migration or after moving the site the images of the media no longer work correctly?
Usually this is because the media path has changed.
In this article we will see how to correct this problem by correcting the media path to a correct path, we will do it by code and also using a plugin.
What problems does having the wrong media path cause?
The main problem is that you will not be able to upload the images correctly and that the thumbnails are not generated correctly.
You may not see the thumbnail images as the path referenced is incorrect or you do not have the correct permissions.
Fix media path by code
The default path WordPress uses to save media is: /wp-content/uploads
Make sure first if this folder exists and has subfolders with the images of your site.
Then locate the file wp-config.php which is at the root of your WordPress installation and add the following line of code:
define( ‘UPLOADS’, ‘/wp-content/uploads’ );
Obviously you can change the path you have by default, just make sure that the path is a path based on the root where your website is.
You can place that code before the final comment line:
/* That’s all, stop editing! Happy publishing. */
Fix media path via plugin
Unfortunately in current versions of WordPress it is not included to change the media path through the configuration screen, so if you get complicated with the code you can consider using a plugin.
The plugin we will use will be .
After downloading and installing the plugin we will see a new option in the Settings menu
You don’t need to enable expert mode, just set the path from your domain and the plugin will set the path for the images.
In the previous image the path is the default WordPress path /wp-content/uploads
Changing the route on an existing site
Keep in mind that this process is only recommended on new sites or sites that have the default path incorrectly established, for which you must explicitly specify the default path where the images are.
If you make media path changes on an existing website that has images assigned to it, then you will have two locations for the images, as the old images will still be in the old path, and the path change you make will only be for the old images. new images.
conclusion
Note that if you don’t display images from a site that has been moved or imported from another site, you may need to specify the WordPress media path explicitly.
As we have seen, changing the WordPress media path is a simple process, especially if you do it through a plugin.
Help us improve our content by sharing your opinion
WordPress technical support at and regular speaker at Meetups and WordCamps in America.