Moving your WordPress website to a different location is a complex and time-consuming process which is further complicated because you cannot simply transfer your files and databases. It’s not the way WordPress functions.
Luckily, WordPress has a built-in “Import” and “Export” tool. However, it will only meet the basic requirements, and you’ll have to modify it slightly to create different effects.
In this post, I’ll walk you through step-by-step steps for migrating the contents of your WordPress site’s information to a different location.
Let’s get cracking!
- Before We Start: Back Up Your Website
- Changing Your WordPress Installation’s URL? Or Transferring a Whole Site?
- How to Move Content From One WordPress Site to Another
-
- Export From Your Old Installation
- Install the Importer
- Upload Your Content
- Assign the Content
- Partial Content Movement
-
- Select the Content You Want to Export
- Import as Before
- Duplicate Media Files
- Export Attachment Posts
- Edit Your SQL
- Import Attachment Posts
- Export Post Meta
Before We Start: Back Up Your Website
Specific WordPress installations or server configurations could present unique issues when transferring Content. While this article will address a unique possibility (namely, the fact that you just need to share a portion or all of your WordPress install’s contents), There’s no assurance that the procedures described in this article will succeed for each setup.
It’s Unsurprisingly, you’re the sole person responsible for your website, even if you follow this advice to the letter. There’s some database work to be done based on what you wish to achieve in the first place, and if you do erase a significant portion of your site, it’s your responsibility. In essence, be cautious with this!
To help you with this post, I’ve made two distinct localhost instances for WordPress to give you images of each procedure. It might be worthwhile to try shifting your Content onto an untested site to see if that it’s working.
I’d recommend creating an archive of your entire website to accomplish this. Of course, you make backups frequently, don’t ya? (If you’re not, you ought to. Get to it.)
If you plan to accomplish this by hand, make sure to include your database and website files (primarily since this is the uploads folder of your site’s website).
Backing Up Files
You can make and download an archive of your site’s files using FTP. How to do this differs depending on the FTP client, but it’s generally simple. Be sure to save and download the compressed backup file like a backup.
Backing Up Your Database
Log in to the phpMyAdmin account and choose the database on which WordPress can be installed.
Choose export from the menu on top. For most users, “Quick” options will suffice. However, if you’ve got tables that aren’t part of those in the WordPress installation, you’d like to backup within the same database, select “Custom” to choose the tables you would like to backup; all other options will remain the same. Then press on the link to download the backup file of your database (.sql formats).
Your WordPress tables are prefixed with “wp_” by default – because I have two instances in the same database, my tables are prefixed with wpmudev_export and wpmudev_import. Here I’m backing up the wpmudev_export file.
The best-case scenario is that backups won’t be required; however, it’s a good idea to have backups before beginning work. If the website on the site you’re moving Content has Content, ensure that you backup that site as well.
With all the safety precautions out of the way, let’s go to work!
Changing Your WordPress Installation’s URL? Or Transferring a Whole Site?
If you’re trying to move your site to a different URL or need to transfer everything from one platform in one to the next, then a significant reason is that you’ve chosen the easiest choice. WordPress’s tool for export and Import can be able to do the job for you. There’s no need to get more complicated in the code.
Here’s how to move everything off your WordPress Content such as pages, images, posts, and everything else – onto an entirely new site.
It’s probably easier to set up a new installation on the brand new host (or even a new server) and then import/export rather than alter the settings of your files. If you prefer to take this route you can, it’s recommended that you consult the WordPress Codex can suggest. Your site should be updated with the most recent WordPress version, so it shouldn’t be a problem. But in the event that it isn’t, you should upgrade it first. If you are unable to update due to some reason – like using an application that isn’t compatible with the latest versions, the new version you install may be an older version. It’s not suggested as a lot of older versions of WordPress contain serious security issues.
How to Move Content From One WordPress Site to Another
Export From Your Old Installation
src=”https://wpmudev.com/blog/wp-content/uploads/2015/08/wordpress-export.png”/>
WordPress’s own Export Tool.
Log into Your WordPress dashboard and choose your Export option under within the Tools section.
Since you’re exporting everything, it’s simple to Select the All Content option on the menu and click the Download Export File button.
A XML document will get created. Make sure to keep it in a secure area and then move it to the installation you’re moving.
Install the Importer
The image alt=”WordPress option to importers.” src=”https://wpmudev.com/blog/wp-content/uploads/2015/08/wordpress-importers.png”/>
This is the WordPress Importers Screen.
When you are on the latest WordPress install, head back in Tools however, this time, select the Import option..
Then, you will be presented with the list of importers from which you must choose your WordPress option.
Choose Download Now and then wait for the importer to be downloaded and installed.
If all goes well and you are satisfied, click to activate the plugin & Run Importer on the next screen.
Now you’re prepared to import the XML file you created earlier is now in play.
Upload Your Content
Upload the WordPress eXtended RSS (WXR) XML file you created earlier.
Click Select Fileon the screen that appears and choose the XML file that you uploaded on the previous site.
Then step, then click upload file and then import.
Assign the Content
src=”https://wpmudev.com/blog/wp-content/uploads/2015/08/importer-post-assign.png”/>
You can import new author accounts or attribute content to authors already in. Make sure you download and import attachments.
You’ll have the option to distribute Content to users already on the new website (if you already have accounts on the two sites, you’ll be able to assign the old Content to the new one) or to create new users with their previous usernames or the new username you choose. This ensures that the Content is linked the author’s account on the new website.
If you have files or images to transfer to the new website, make absolutely sure that you check the box to download and import attachmentsas it isn’t the default option.
Click click the button to submit the to submit the form and then you’re completed! The page might take longer than usual to load due to the fact that it’s creating new records in the database but the page will finish it. It’s best to wait until it’s processed and all your Content will be migrated to the new website and ready to begin its time there.
Partial Content Movement
This is the easy part to get out of the way. If you’re trying to export just part portions of your site’s contents I’m afraid to say WordPress’s tools won’t be able to satisfy your needs by themselves.
The option of selecting the entire Content will be the sole option to export attachments (files which are listed in your media category). So, if you wish to transfer a particular portion of your Content as well as the images you have, then need to transfer everything over, then remove it (time demanding for large websites) or look around your database and files, which I’ll demonstrate how to do right now.
The exporting and modifying SQL I’m about to explain will be demonstrated to move attachments, however you can also apply similar methods to move the entire database across. This is a good option when you need to transfer everything, but the XML data is too big to upload via the importer.
Select the Content You Want to Export
Go back and go to tool> Export screen to start.
The image alt=”Export screen with selected posts.” src=”https://wpmudev.com/blog/wp-content/uploads/2015/08/export-custom.png”/>
In this case, I’ve chosen to only export posts post the mid-2010 period from a particular author. You may also opt to ship based on the status (eg. Pending, published Draft, Published) or by category. Other content types like pages (or Feedback, Portfolio, etc. If they are enabled) can be chosen.
After you’ve chosen the items you’d like to export After that, click “Download Export File” the same way as before. If you have multiple choices you’d like to include (eg. two authors’ posts within the same time frame or an individual’s pages and all of their pages) It’s completely possible to return and create multiple Export files to each one.
Import as Before
Once you’ve got every one of your WXR XML files you wish to you can go to the latest website then install the importer for WordPress, as previously demonstrated. Upload all of your files (one at one time) like before, and then they’ll upload the appropriate pages, posts or other Content on the website.
But this isn’t the end of the story, as you’ll find that you do not include any attachments (eg. uploaded images) in your installation at the moment.
Duplicate Media Files
Visit your old version’s FTP client and look for the the /wp-content/uploadsand folder. The Windows 10 version of File Explorer as my FTP client, however most will be capable of compressing files, in order to download them.
0
Image alt= “Sending to a compressed (zip) document.” src=” https://wpmudev.com/blog/wp-content/uploads/2015/08/compress-uploads.png”/>
Based on the FTP client the process of compressing all folders in the directory for uploads into an .zip file is accomplished by using different techniques.
You can download the .ZIP file you’ve created then upload to the new site’s FTP (or simply copy it and paste it into your FTP if have access to both sites via FTP using your FTP clients).
Image alt=”Moving uploaded .zip.” src=”https://wpmudev.com/blog/wp-content/uploads/2015/08/move-uploads.png”/>
I’m cutting and pasting my compressed files across, but you are able to download and upload them if you have to switch among FTP clients.
Then, you can extract all the files in the compressed folder to the directory called Uploads.
However, this isn’t the end of it. Even if your files are stored in the right location but your WordPress installation will not be aware of them since the details of attachments aren’t yet transferred to the databases.
Image alt=” No media attachments were found.” src=” https://wpmudev.com/blog/wp-content/uploads/2015/08/no-attachments.png”/>
The new WordPress database doesn’t have any information about your files that you’ve transferred onto the new server.
Export Attachment Posts
Visit the old site’s phpMyAdmin database and locate the WP_Posts table (replace wp_ with your preferred prefix if necessary).
The image alt=”wp_posts Table SQL.” src=”https://wpmudev.com/blog/wp-content/uploads/2015/08/wp_posts-sql.png”/>
Also I used wpmudev_exportposts however, you must replace the table’s name with the correct prefix for your database.
In this case you will need to locate those attachments (those are media posts) then paste this SQL (changing the table’s name to include the correct prefix, if needed) and click go.
SELECT * FROM `wp_posts` WHERE `post_type` = “attachment”
src=”https://wpmudev.com/blog/wp-content/uploads/2015/08/select-export-all.png”/>
This SQL query returns only attachments.
Scroll down to the end of the results page and make sure to check for all to ensure that all attachment posts are displayed. When all rows are displayed, select to check all and then select to export..
Then things become a little more complicated, but just stay in my direction and go through my instructions carefully and you’ll be fine.
For the purposes of the picture, the options you’ll need to change have been moved up the page. You may need to scroll down to find them.
- Select “Custom” to display all the possible options.
- Scroll down until you reach the Optional Formats section.
- Select your data.
- Everything else is left in its place and click go.
- Edit Your SQL
This is required when your new install has a an alternative database prefix than the one you downloaded the SQL Export file.
Modify the .sql file with an editor for text such as Notepad++ and replace the prefix of the previous one with the new prefix.
Image alt= “Find and edit prefixes in SQL files.” src=” https://wpmudev.com/blog/wp-content/uploads/2015/08/wp_posts-sql-prefix-edit.png”/>
In my instance, my first database was prefixed with by wpmudev_export, and the one I’ll be moving attachments is prefixed with wpmudev_import!
If the prefixes of your tables are the identical (eg. the tables both have the same wp_posts) it’s okay and you’re free to skip this step.
Import Attachment Posts
src=”https://wpmudev.com/blog/wp-content/uploads/2015/08/wp_posts-import.png”/>
Always, look up the table with the appropriate prefix if applicable!
Log into your database and search for wp_posts (or equivalent) Click Import.
Click Select File Make sure to click and don’t drag it into the first place, since this will mean it won’t be uploaded to the correct location – then select the export SQL file.
All other options remain as they are and then execute the query by pressing the Go button. You’ll get a confirmation message when it’s done and all the attachments will be displayed under Media however there’s another step to take before your pictures begin showing correctly.
Image alt= “Media library showing only images, not files.” src=” https://wpmudev.com/blog/wp-content/uploads/2015/08/media-no-img.png”/>
As you can observe, none of the images show up as images…yet!
Export Post Meta
Again, the options you need to change are on this picture. You may need to scroll to find them.
Similar to the database operation This time, locate the old database’s postmeta table, and then select on the export tab.
Click on the Custom settings once more and select data instead of structures and data like before.
Also, look for this heading under the Data Creation Options heading and select REPLACE as the option to be used when you dump data.
Again, click Next, click to download and create you SQL file.
Leave a Reply