People proudly say WordPress powers more than 40% of the sites on the web. But you will be surprised to see how difficult it is, when using the popular content management system. Migrating from one hosting company to other company is one of the serious problems with WordPress sites. This will be easier when you move the entire cPanel and the new hosting company helps in free or paid migration. Unfortunately, it is not always the case that you move entire hosting account to another service. Most of the time, what you need is to move only some of the sites you own. In such kind of scenarios, there are plenty of practical problems will arise and moving WordPress media library is the biggest pain you will face when migrating sites.
Why Moving Images is Pain?
Over the period of time you might have accumulated lots of images on your site. Each image will have different thumbnail sizes based on your theme. In general, any commercial theme will use at least 8 to 15 thumbnails for each image. So, when you have 1000 images on your site the total file count will become 8000 to 15000 depending on your theme.
Many hosting providers like SiteGround, WPEngine and Kinsta offers custom setup and you need to manually move the sites when migrating to other company. Downloading such large volume of image files and again uploading to the new platform through FTP will easily take few days of your time. On top of this, the problem is different that WordPress does not support registering these images. This essentially means you will not see any of the uploaded images through FTP under “Media > Library” in WordPress admin dashboard. Remember, your site will still work properly and show all the images from the server.
Below is an example showing all the images are available in the server uploaded through FTP.
But you can’t see them in the WordPress dashboard under “Media > Library”.
It will lead to a situation that you can’t reuse those images anywhere on the site because it will not be visible from “Add Media” option in post editor.
Let’s see how to fix this problem with least time consuming method.
Fix WordPress Media Library Not Showing Images Uploaded with FTP?
Here are the steps involved in the entire process:
- Install Media to FTP plugin
- Check upload paths
- Set image register date
- Update images to media library
- Attach images to posts
- Fix broken links
Let us explain each step in detail.
1. Install Media to FTP Plugin
Though the situation is bad, the good part is that WordPress has plugin for every problem. Go to “Plugins > Add New” and search for “media to FTP”. You will see the Media from FTP plugin in the list, install and activate it on your site. Though this plugin was not updated for many years, it works fine and further sections of this article shows screenshots from this plugin. However, the same author released another plugin called Bulk Media Register which also can be used for this purpose.
2. Verify Media Upload Paths
Go to “Media from FTP” menu and verify the “Server path status” section that all upload paths are correct. This is required especially if you have changed the default WordPress media folder path.
3. Set Image Register Date
Here is the problem again, if you were using organize uploads into month and year based folders. Let’s say you have an image1 on the original site uploaded on 08/2017. If you have arranged the uploads into month-and-year-based folder, then the URL should be:
Now that you have uploaded the image to the new hosting platform through FTP on, say 28.06.2018. You may be using the plugin on the same day or one day later like 01.07.2018. The plugin will not help you to retain the original date of 2017/08. What you can get is either 2018/06 or 2018/07. Go to “Media from FTP > Settings” and set the necessary option for this date and choose the organize uploads option if you previously use.
4. Update Images to Media Folder
Go to “Search & Register” option to see the screen like below:
- You will see the warning message showing that the images will be updates into month-year structured folders. So be sure that you were previously using the same structure, otherwise disable the option on your new site.
- Choose the folder from where you want to import the images. You can either do folder by folder or choose “/wp-content/uploads” folder from the drop-down.
- Click on the “Search” button to get the list of images from the server. You can also filter different media types and extensions.
- The bulk change date option will set the month/year for all image URLs based on this date.
- You can set different date for each image in the text box. The date shown in this box is the date you had uploaded the image through FTP.
- Remember none of the above dates are the original image uploaded date on the site. You can get this only from the image URL. If you have less images then check the current image URL and set the same month/year in the date field. This will ensure the image URL is not changed. If you have many images then it’s up to you to either modify one by one or use bulk change date.
- Select either individual images or select all for bulk update.
- Click on the “Update Media” button to upload the selected images to media library.
The upload process will take some time based on the number of images selected.
5. Attach Images to Posts
Once the process is completed, you can view all the imported images in “Media > Library” folder. The images are not attached to any posts, so you should select and attach images to the correct post. This is required especially if you are redirecting image attachment URL to post URL in Yoast SEO.
If you don’t attach the image to any post URL, they will be indexed in search engines with the image URL.
6. Fixing Broken Links
If the image URLs changed in the above process then you should check for broken links and fix the errors manually. Remember when the imported image URL is different, the image will still be showing on the site from the server. So you will not see broken images but the same image will be available in two different folders, probably like “/2017/08/image.png” and “/2018/06/image1.png”.
Note: You can also install Force Regenerate Thumbnails plugin and regenerate all the imported images if required. Also, if you have changed the domain name or media upload path then use search and replace function to change the URLs for all image attachments in one click.
Now that you will start hating those people telling WordPress is the powerful CMS in the world. Yes, it’s powerful but it has many restrictions due to security and other reasons. But at the end you can’t host all the sites on the same hosting company till the end. And migrating sites to different hosting company will be a pain due to these types of restrictions.