Fastest Way to migrate your site from wordpress.com to wordpress.org
Tags: wordpress, cpanel
Published: 2022-02-15 19:54:42

<!-- wp:paragraph -->
<p>In this tutorial , I am going to be addressing two things:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>1. How to move your wordpress.com site to wordpress.org. </strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>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.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>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 <strong>WP_CLI</strong> to import the exported xml file. Using the wp-CLI(ssh/terminal) large xml imports will run faster and successful.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="export-wordpress-com-site">Export Wordpress.com site</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Login in to your wordpress.com website, go to your dashboard. On the dashboard side menu, click on <strong>tools</strong> then <strong>export</strong> after that you click <strong>export all</strong></p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/le994ovp3fcjnc67sivb.png" alt="Image description"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Next step,…</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="importing-xml-file-using-wp-cli-via-ssh-on-wordpress-org-site">Importing xml file using WP-CLI via SSH on wordpress.org site</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>In this section, we are going to setup a fresh wordpress installation on a web host.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>I want to assume you already have a web hosting subscription if not, you can check out my recommended webhosting platform, <a href="https://www.interserver.net/r/794042">Interserver</a> (NB: I actually use their service and my experience has been wonderful).</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you are not familiar with installing wordpress, you can check this <a href="https://www.interserver.net/tips/kb/install-wordpress-using-softaculous-in-cpanel/">guide</a> to do so.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2 id="importing-wordpress-com-exported-xml-file-on-your-self-hosted-wordpress-site">Importing wordpress.com exported xml file on your self hosted wordpress site</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Here is the thing, there are actually two ways to go about this…</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li><strong>Using the wordpress import plugin via the self hosted wordpress admin area</strong></li><li><strong>Using WP_CLI</strong></li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Lets begin the process,…</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2xeinth7or4tu6s7u7c.jpeg" alt="wp_move_wordpress_file_manager"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Click on the file-manager, you should be redirected to an interface where you can see a couple of folders.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A typical wordpress root folder is located in the <code>public_html</code> 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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The file circled purple is actually an exported wordpress.com exported site. Notice that the file has a <code>dot xml</code> file extension. <em>**The one used in this example is about 14MB with oabout 2k+ data… Quite huge…any way, back to the matter **</em> 😁</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ozs2c9077n0wensy42ee.jpeg" alt="wp_file_manger_wordpress"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>**</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 id="next-open-ssh-terminal">Next, open ssh Terminal,</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>**…<br>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,</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0p9jsmnhzzdwyteqrlgq.jpeg" alt="terminal wordpress "/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>To access the root folder for our wordpress installation where the xml file is located, we'll <code>cd </code>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 :</p>
<!-- /wp:paragraph -->

<!-- wp:codemirror-blocks/code-block {"mode":"powershell","mime":"application/x-powershell"} -->
<div class="wp-block-codemirror-blocks-code-block code-block"><pre>cd domains/yourdomain.com/public_html</pre></div>
<!-- /wp:codemirror-blocks/code-block -->

<!-- wp:paragraph -->
<p>In my own situation, for my website, <a href="https://jovialcore.tech">jovialcore.tech</a> this is how it looks:</p>
<!-- /wp:paragraph -->

<!-- wp:codemirror-blocks/code-block {"mode":"powershell","mime":"application/x-powershell"} -->
<div class="wp-block-codemirror-blocks-code-block code-block"><pre>cd domains/jovialcore.tech/public_html</pre></div>
<!-- /wp:codemirror-blocks/code-block -->

<!-- wp:paragraph -->
<p><em><strong>the folder structure is like that in most cases</strong></em></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>**</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4 id="lets-install-the-wordpress-importer-plugin">Lets install the wordpress importer plugin.</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>** Type the following command in the terminal.</p>
<!-- /wp:paragraph -->

<!-- wp:codemirror-blocks/code-block {"mode":"powershell","mime":"application/x-powershell"} -->
<div class="wp-block-codemirror-blocks-code-block code-block"><pre>wp plugin install wordpress-importer --activate</pre></div>
<!-- /wp:codemirror-blocks/code-block -->

<!-- wp:paragraph -->
<p>After that, lets import the xml file.<br>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.</p>
<!-- /wp:paragraph -->

<!-- wp:codemirror-blocks/code-block {"mode":"powershell","mime":"application/x-powershell","theme":"bespin"} -->
<div class="wp-block-codemirror-blocks-code-block code-block"><pre>wp import wordpress.2020-04-14.000.xml --authors=create</pre></div>
<!-- /wp:codemirror-blocks/code-block -->

<!-- wp:paragraph -->
<p>Note the <code>--authors=create</code> 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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Yaah..your import should begin immediately lke so:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jzs08a05n4a6xwrue2yi.png" alt="wp_Import_in_progress"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>It could take some time depending on the size of the file, when the import is complete, the status should should look like this:</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1xy13pfkipgfms063m18.png" alt="wp_import_success"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>We are done with the import, go back to your cpanel file manager and delete the <code>xml</code> file we uploaded.<br>Refresh your website to see the changes.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>That should be all….</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Conclusion:</strong><br>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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Reach out to me on <a href="https://www.linkedin.com/in/chidiebere-chukwudi-49a982182/">linkedin</a> or <a href="https://twitter.com/jovial_core">twitter</a>. You can send me a mail <a href="mailto:chidideveloper@gmail.com">chidideveloper@gmail.com</a></p>
<!-- /wp:paragraph -->