How to Migrate from WordPress To Ghost
Migrating to Ghost from Wordpress does take a few steps at this point in time, but we will cover everything you need to get all your data over.
If you are haven't yet decided where to host your Ghost blog or need help on installing it, check out our post on where to host your Ghost blog
In this post we will be discussing the following aspects of migrating from WordPress to Ghost:
- Transferring WordPress content to Ghost
- Transferring WordPress images to Ghost
- Transferring WordPress comments to Ghost
- Pointing your domain at your new Ghost blog
If you have an existing Wordpress blog and want to migrate the blog posts over to Ghost, below are the steps.
- Install the Wordpress Ghost Plugin (http://wordpress.org/plugins/ghost/faq/)
- In the Wordpress admin console, on the left side go to Tools -> Export to Ghost
- Scroll to the bottom and press "Download Ghost File"
- Save the file to your Desktop
- Keep this file for now, we will come back to it after we do the images.
Transferring Wordpress Images to Ghost
Now that you have a local copy of your WordPress content, we shift over to migrating your images over to Ghost. There are two steps to handle the WordPress images:
- Move the images from the server hosting WordPress over to the new server hosting Ghost.
- Modify the WordPress export of your content to point at the images on your Ghost server.
Note: If you are hosting on Ghost(Pro), once you download your images, contact their support team and they can finish getting you setup since you don't have access to the backend
For the first step you can either:
- use an FTP application to pull down your WordPress images to your computer and push them up to your Ghost server (easiest)
- or you can use the command line on your WordPress server to
scpthe images over to your Ghost server
If you are unsure how to do this, it can differ for every host. It is usually best to contact the support team of the hosting company for your Wordpress blog and they can help you get the images.
Regardless of which method you use, on the Ghost server, the images need to end up in:
If your ghost blog is living somewhere other than
/var/wwwthen adjust the path above, but most installs should be living there
Once the transfer is complete make sure you set the ownership on all of images:
chown -R ghost:ghost /var/www/ghost/content/images
Now that the images are on your new Ghost server, you will need to modify the WordPress backup to convert the WordPress directory structure over to the Ghost structure. On your computer open up your terminal application and run the following command (replacing
wp2ghost_export_1418184250.json) with the name of your WordPress export):
sed -i .bak -e 's|wp-content\\/uploads|content\\/images|g' wp2ghost_export_1418184250.json
That command will take your WordPress backup and replace
content/images. It will also create a new file called wp2ghost_export_1418184250.json.bak that is the original contents in case you need it.
Now that the export is ready for Ghost you can import your data into Ghost.
- Now head over to the debug section of your ghost website at
- Click on "Choose File" and select the file that the Ghost plugin created and we edited, and click "Import"
- All of your posts with the images should now be imported into your Ghost site!
At this time, Ghost does not have any built in commenting system. The most popular alternative is Disqus, so this section will detail how you can migrate all of your WordPress comments to Disqus and how to integrate your Disqus comments into Ghost.
The basic idea is:
- [Sign up] for Disqus account
- Install [Disqus plugin] in your WordPress blog
- Export comments to your Disqus account from within WordPress plugin
- [Add Disqus comments into your Ghost blog]
Disqus Account Sign Up and Integration into Ghost
If you purchased or download a theme, a bunch already have the disqus code in place and all the theme needs is your account number. Check out your theme documentation to see if it has that ready for you, but this section will assume there is nothing built in.
Head over to Disqus and signup for an account
Once you have signed up check your email and click the Disqus verification link.
Inside your theme, the file you are going to edit is
post.hbsand is located at:
Open up this file with a text editor
If you scroll down a little bit inside the file, you will see this code (assuming you are using the Casper theme, may be different if you are using another theme):
Paste the code you copied from Disqus right below that section and save.
Upload your theme to get the new files in place. If you have Ghost running, stop and start it. Now when you navigate to a post, you will see a comment section like the following screen shot!
Now we just need to migrate your existing comments over to Disqus.
Migrate WordPress Comments To Disqus
- On your WordPress Dashboard click on Plugins
- Click on
- Search for
- Click on
- Fill in your Disqus username and password that you just signed up with
- Select Disqus site name and click Next
- Click on the
- Click on the
- Wait until you receive an email from Disqus saying the import is complete.
- Click the link in the email that Disqus sent to check on the status of Disqus processing your comments.
- If Disqus is done processing your comments you will see a message at the top saying so.
Now all of your comments are over on Disqus, so when you switch to Ghost, as long as the posts are the same domain name and URL (they should) the comments will come over no problem.
How to point your domain from WordPress To Ghost
The steps documented will be to point a domain purchased at Namecheap to your [DigitalOcean](http://www.howtoinstallghost.com/how-to-install-ghost-on-digital-ocean-vps/"How to install Ghost on DigitalOcean") droplet running Ghost.
We have chosen to document Namecheap and DigitalOcean because of their popularity, but almost every domain name registrar has similar steps. If you have questions, contact your provider and they can probably just do it for you.
Log into Namecheap (or whatever host you are using).
On this page click on Transfer DNS to Webhost. Then you have the option to input custom DNS Servers. By inputting custom DNS server you can configure where your domain name points to. In this example, we will input the nameservers for DigitalOcean.
In custom DNS servers 1 - 3 fill in the following
ns1.digitalocean.com ns2.digitalocean.com ns3.digitalocean.com
Now click Save Changes.
Next log into your DigitalOcean account. Once logged in click on the
Networkinglink at the top.
Click on the
Domainsbutton on the left.
Now type in your domain name, and select the droplet that you want it to point to (probably the only one listed).
Thats it! It may take a couple hours to propagate through the system.
Again it may be different for your specific domain name registrar, but it should be a similar process. If you run into trouble, most of the big companies have 24/7 online chat support who can do it for you or show you how.
Hopefully this should have given you everything you need to transfer from Wordpress over to Ghost. If you run into any problems, feel free to leave a comment or tweet at us. Thanks for reading and have fun on Ghost!