Fastest Way to migrate your site from wordpress.com to wordpress.org
In this tutorial , I am going to be addressing two things:
1. How to move your wordpress.com site to wordpress.org.
2. How you can import large files in wordpress via wp-cli, as this is the fastest way to import large files like exported xml files, etc.
To move a wordpress.com site to wordpress.org, we will first export the wordpress.com website after which we will use our ssh terminal/commandline via WP_CLI to import the exported xml file. Using the wp-CLI(ssh/terminal) large xml imports will run faster and successful.
Export WordPress.com site
Login in to your wordpress.com website, go to your dashboard. On the dashboard side menu, click on tools then export after that you click export all
WordPress.com will mail you a download link for your exported site that has a 7 days lifetime before it expires. Download the file from your mail then unzip it, you will see a dot xml file. The xml file has all your posts, images, comments etc from the wordpress.com site.
Importing xml file using WP-CLI via SSH on wordpress.org site
In this section, we are going to setup a fresh wordpress installation on a web host.
I want to assume you already have a web hosting subscription if not, you can check out my recommended webhosting platform, Interserver (NB: I actually use their service and my experience has been wonderful).
If you are not familiar with installing wordpress, you can check this guide to do so.
Importing wordpress.com exported xml file on your self hosted wordpress site
Here is the thing, there are actually two ways to go about this…
- Using the wordpress import plugin via the self hosted wordpress admin area
- Using WP_CLI
This tutorial is basically for the second method, why ? Again, this is faster, no php time outage, and you are sure your import will be completed successfully.
Lets begin the process,…
First login to your webhosting cpanel, look for file-manager tool (circled red in the screenshot below); It may vary in position depending on your cpanel interface design.
Click on the file-manager, you should be redirected to an interface where you can see a couple of folders.
You do remember the xml file we downloaded from mail and unizipped right? We will be uploading that file to the root folder of our wordpress installation.
A typical wordpress root folder is located in the
public_html named folder, or sometimes,your root folder location might be different but I am sure that your wordpress root folder will contain folders and files like the one in the screenshot below.
The file circled purple is actually an exported wordpress.com exported site. Notice that the file has a
dot xml file extension. **The one used in this example is about 14MB with oabout 2k+ data… Quite huge…any way, back to the matter ** 😁
Next, open ssh Terminal,
Now that the exported file has been uploaded, look for the ssh terminal tool listed on the cpanel section then click to open it up,
To access the root folder for our wordpress installation where the xml file is located, we’ll
cd in the root directory via the ssh/terminal. Hey…but this entirely depends on your folder structure but generally it should look like this below :
In my own situation, for my website, jovialcore.tech this is how it looks:
the folder structure is like that in most cases
Lets install the wordpress importer plugin.
** Type the following command in the terminal.
wp plugin install wordpress-importer --activate
After that, lets import the xml file.
Type the following command in the terminal followed by the file name we uploaded initially in the root folder of our wordpress installation, then click enter.
wp import wordpress.2020-04-14.000.xml --authors=create
--authors=create flag: it is used by wordpress during the import to automtically create a website author for each posts typically based on the website domain name.
Yaah..your import should begin immediately lke so:
It could take some time depending on the size of the file, when the import is complete, the status should should look like this:
We are done with the import, go back to your cpanel file manager and delete the
xml file we uploaded.
Refresh your website to see the changes.
That should be all….
Using WP-CLI approach via terminal is significantly better over admin interface with the import plugin as you don’t have php time outage issues, large files are imported successfully, etc.