Join Morten Rand-Hendriksen for an in-depth discussion in this video Move the necessary files with FTP, part of Migrating WordPress with WP Migrate DB and DB Pro.
- In this first chapter, I'll show you how to migrate a WordPress site from one location to another using the free WP Migrate DB plug-in. Now, right off the bat, I'm faced with a bit of a chicken-and-egg problem. What do I move first, the files or the database? The reality is, it doesn't actually matter. Both produce the same results in the end. It's really all a matter of preference. You can do either one first, but in my mind, it logically makes more sense to move the files because once you move the database, you want to test everything and it's hard to test it unless you've already moved the files over and they're available on the target server.
In my sample, I want to move the files from my locally hosted origin site to the remote hosted target site at themeweekend.org using FTP. Now, we're not talking about moving all of WordPress here. We're only talking about moving the content that may have been uploaded to WordPress when the site was set up. And all the contents is contained within the WP Content Folder. When you open your WP Content Folder, you may find a series of different folders, plug-ins, themes, uploads, upgrade, and if you're using WordPress under a different language, you'll find a languages folder here as well.
Of all these folders, the only ones that matter are plug-ins, themes, and uploads. Before we do anything, let's quickly compare my origin files to those on the target site. Here we see the origin site on the left-hand side, and the target site on the right. If I navigate to WP Content and plug-ins in both these views, you'll see on my origin site I have a long list of plug-ins. Each of these folders is a plug-in. And on the target site, I only have two, akismet and hello. That means to get the two sides to match, I need to move all the plug-ins I'm using in my current site over to the target site.
In practical terms, that simply means copying files over. So here I'll grab all the folders and files that are not present in the target location, and simply drag them over. Depending on how many plug-ins you've installed in your origin site, this process may take a while, and in some cases it might actually make more sense to go to the target site and install all the plug-ins manually from within WordPress. Once the plug-ins are successfully migrated, we can go back one step on both sites, and then move on to themes.
Here you're most likely only going to move one theme, in my case, popper, so I'll just simply drag that over. And once that's done we move on to the uploads folder. Now the uploads folder is actually the most important folder in this discussion, because both plug-ins and themes can always be added later from WordPress itself. The uploads are all the images and other documents you've uploaded to your WordPress site manually, and these need to be migrated in full over to your new site. When you go into the uploads folder, you can see that the uploads are organized based on year, and then based on month.
So here I'm simply going to grab all the folders from my origin site and drag them over to the target site. Now depending on how many uploads you have on your site, this process may take a while. You can see here I have to transfer over 2,000 files, and so FTP, that's going to take quite a bit of time. So this will be a good time to go grab a coffee or grab a book or do something else, and then come back when the process is complete. Once the transfer process is complete, make sure you have no failed transfers or any other errors showing up in your FTP application.
If everything went right, you should now be able to log in to the back end of your target site, go to the Appearance tab and see the new themes you've uploaded, in my case, popper. The same should happen if you go to plug-ins. You can see here all the plug-ins I transferred over are available in the target site. Now, there's no point activating any of this, because the actual activation happens once we move the database. That's because the database contains information for WordPress about which plug-ins and what theme is currently active. So when we move things over, it'll just automatically happen.
We don't have to worry about any of that right now. There's one more thing. You remember we moved the uploads folder and all the media files, and chances are, you may click on the media button only to discover there are no media items. So what's going on here? The media items are sitting there on the remote host. You can see them if you use the FTP application and go to uploads, but unlike the themes and the plug-ins, WordPress is not registering any of the media items yet. That's because in WordPress, each media item, so every picture and anything else you've uploaded, is actually a post in the database.
Because we haven't migrated the database yet, WordPress has no idea these items exist. So they don't show up under media. However, once we migrate the database, all the media items will just magically appear under the media library.
- Moving files via FTP
- Installing WP Migrate DB on both sites
- Exporting and importing the database
- Using the WP Migrate DB Pro
- Understanding push and pull
- Moving files with the Media Files add-on
- Troubleshooting common WordPress migration problems