Moving your WordPress site from one location to another can be a daunting, difficult, and tricky process for the uninitiated, particularly when considering the fact that WordPress will not allow you to simply move your files and database. There is a useful ‘import’ and ‘export’ tool on WordPress but unfortunately this will only be suited to all but the most basic requirements. In order to make a full migration to another site, you’ll have to be a bit crafty. So here is a step-by-step guide on how to move your content from one WordPress site to another.
Backup Your Website
One of the most important steps and something that goes without saying. Though this article will help you with making the transfer from one site to another, it is only a guide that might not be applicable with all your requirements. You might want to test things out by yourself, or make an accidental mistake in the process, which may lead to deleted content or changes that cannot be reversed. That’s why backing up your website is so important! Have that safety net there incase you are faced with the unimaginable. Be sure to take a look at these set of instructions by WordPress on how to backup your website.
Changing To A New URL Or Whole Site Transfers
If you are just looking at changing your website to a new URL or transferring all of your content from one installation to another, then fortunately this is fairly easy to do. The aforementioned ‘import’ & ‘export’ tools should work just fine. Firstly, ensure your installation is upgraded to the latest version of WordPress. Your new installation can be an old version, but this is not recommended as you will be subject to security flaws.
- Export From Your Old Installation
On the WordPress dashboard, go to Tools on the left hand side and choose the Export subitem found underneath. As you are exporting everything, select the All content option and then press the Download Export File. This will create an XML file. Store it somewhere safe and head over to the new installation.
- Install The Importer
On the new WordPress Installation, go back to Tools and this time select the Import subitem. A list of importers will come up, from which you select the WordPress option found at the bottom. Click Install Now and the importer plugin will begin its download. Once that is done, you can click the Activate Plugin & Run Importer on the next page. Now you just need to import the XML file you generated earlier.
- Upload Your Content
You will be sent to the Import WordPress screen. Now you just simply have to press Choose File button and select the XML file you created earlier and click Upload File & Import.
- Assign Authors
Nearly there! You’ll next be given the option to assign content to existing authors on the new site or create new users either with their old usernames or new usernames. Remember, if you have any images or files to move to the new site, the make sure you tick the Download and import file attachments found at the bottom. Once you’re finished, hit the Submit button and you’re done!
Partial Content Transfer
This is where things begin to get tricky, as WordPress does not completely cater to partial site transfers. There are two ways you can do this: 1) do a whole site transfer than manually delete what you don’t need or 2) manually go through your files and database. Either way, this could be time consuming depending on the content. In this article, we will show you how to manually go through your files and move what partial content you want to transfer. It is also recommended that you follow a video tutorial on this.
- Select The Content To Export
Once again, head to Tools and then Export. Head to either Posts or Pages and select which content you would like to export. Once selected, hit the Download Export File. If there multiple selections you would like to export, then keep-in-mind that it is entirely possible to go back and create multiple export files.
- Import As Before
After you have created the XML files you want, then follow the same instructions as for the Whole Site Transfer. You can upload your files one at a time and WordPress will install the specific posts/pages/other content onto the site. Unfortunately, it does not end there as you will notice you will not have any attachments, such as media files, on your new installation just yet.
- Duplicate Media Files
Go to your old installation’s FTP client and find the /wp-content/uploads. From here, you should be able to compress files and download them. Download the .ZIP file you just generated and upload it to your new site’s FTP, or cut and paste it if you can access both sites through your FTP client. You can then extract all the files into the Uploads directory.
- Export Attachment Posts
Once uploaded, head over to your old site’s phpMyAdmin database and find the wp_posts table (replace wp_ with your prefix as necessary). At this point, you need to find the attachment posts so paste in the following SQL (changing the table name to have the right prefix if necessary) and hit Go. At the bottom of the query results, check the Show all box so all attachment posts are showing. Once all rows are displayed, check the Check All box then click Export. On the next screen, check the following before continuing: 1) Choose Custom to show all possible settings 2) Choose data (do not select data and structure) under the Format-specific Options section 3) Leave the rest and click Go.
- Edit Your SQL Export File
This step is only necessary if your new installation has a different database prefix to the one from which you downloaded your SQL export file. If both prefixes are the same, then skip this step. To do this you will have to edit the .sql file using a text editor (eg Notepad++), which will find and replace the old prefix with the new prefix.
- Import Attachment Posts
Go to your new database and find the right prefix and click Import in the top heading. Click Choose File (do not drag it in) and select the exported SQL file. Leave the rest as is and click Go at the bottom. Once finished, and if successful, then all your attachments will now be visible under Media on the dashboard.
- Export & Import Post Meta
The attachments will appear, however they do not seem show up properly. This will require an additional step to remedy. In phpMyAdmin, look along the lefthand side and find wp_postmeta table and hit the Export tab up the top. As before, select Custom and data, but this time also choose REPLACE next to the Function to use when dumping data option. Leave the rest and click Go to create your SQL file. Remember, if your new installation has a different database prefix to the one from which you just downloaded the file, you will have to edit the SQL file using a text editor. When editing, you should also find all references to your old URL and replace them with the new URL (if necessary). Go to your new postmeta table and, exactly as before, import the new SQL file into the installation (see instructions above). If all the correct steps were followed, you will find you media library complete and ready to be placed back into the transferred content.
And that’s about the gist of it! We hope you have found this article helpful. Remember that our team at Unidad22 would be happy to assist you in either a whole or partial WordPress site transfer, so be sure to contact us and let us help along the way.