<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=172061883552505&amp;ev=PageView&amp;noscript=1">

Subscribe to Our Blog

Stay up to date with the latest marketing, sales, and service tips.

How To Export a HubSpot Blog to WordPress

Exporting a HubSpot Blog to WordPress

 HubSpot | 6 min read

At Bluleadz, we love HubSpot – but we get it, it's not for everyone.

If you're trying to get off the platform, WordPress is probably one of the first options that comes to mind (it does power 30% of the internet after all). If you've tried to use HubSpot's export blog posts feature, you already know that the exports do not contain any of your post content. This sucks!

The traditional way to get your posts out of HubSpot and into WordPress would be to copy and paste each post by hand. I don't know about you, but no way am I going to do this migration by hand! πŸ˜ 

Well, fear not, my fellow lazy employee trying to get out of copying and pasting posts for days on end... we've come up with a solution that requires minimal effort and will save you from losing your mind to monotony.

Because of the simplicity of the CSV file syntax, it's not that hard to generate your own export from a coded HubSpot template. 

Here's how to do it:

Step 1: Create a New Blog Template

In the Design Manager, create a new coded template titled "Blog Exporter."

make-exporter

Step 2: Copy and Paste

Remove all of the default code inside this new file. Then, copy and paste the following snippet and update it to reference the blog you'd like to export:


{% set export = blog_recent_posts('YOUR_BLOG_ID_HERE', 200) %}
"post_title","post_slug","post_date","post_content","post_thumbnail","post_author","post_category",
{% for content in export %} "{{ content.name|forceescape }}","{{ content.slug|forceescape|replace('blog/', '') }}","{{ content.publish_date_localized|forceescape }}","{{ content.post_body|replace('"','""')|forceescape|escape_jinjava }}","{{ content.featured_image }}","{{ content.blog_post_author }}","{{ content.topic_list|forceescape|replace('[', '')|replace(']', '') }}"
{% endfor %}
{% endif %}


What this does is loop through your posts and escapes the data, all while putting the data into a CSV format – the reason for the awkward formatting.

Your template should now look like this:

code-preview 

Step 3: Preview Page (More Copy and Paste)

From this point, you should preview your blog listing by clicking on the "Preview" dropdown and selecting "Preview without display options.

preview-without-options

 

Next, select all the text in the preview and copy it.

Pro Tip: the blog_recent_posts function can output up to 200 posts. You can work around this by using a standard blog listing and setting the Post Count to as large as 1000. You'll want to set this back to where you had it quickly to minimize the  disturbance to your live blog.

Step 4: Save as a CSV

Open favorite text editor (VSCode is great and free) and paste your copied text into it:

csv-preview

Finally, save the file as importer.csv

Step 5: Setting Up WordPress

At this point, we're done in HubSpot. You'll want to install and activate WP All Import. While the plugin is free, they do offer a Pro version that will automatically download all of your images and upload them into your WordPress install for you during the import (which is very handy).

install-wp-all-import

Step 6: Setting Up the Import

All Import: Step 1

You should now have a new Admin Page called "All Import" accessed from the new item at the bottom of your Admin Sidebar called "All Import." Click "Upload a file" and select your CSV. Once it uploads, click "Continue to Step 2."

csv-import-s1

All Import: Steps 2-4

Step 2 is simply a preview of the data it gathered from the CSV. If you've been following along carefully, everything should be fine and you can continue straight to step 3.

In step 3, we'll be mapping all the data to their WordPress equivalent fields. Simply drag the field name from the right sidebar into the content area you would like to match it to. To start, drag "post_title" and "post_content" into the title and content fields respectively.

csv-import-s2-1


If you purchased the Pro version, you can configure the image importer by expanding the "Images" accordion, but the default settings should be fine.

Next, expand the "Taxonomies, Categories, Tags" accordion. WordPress has a much more robust taxonomy system than HubSpot does, but a HubSpot Topic most closely relates to a WordPress Category. Check the "Categories" checkbox and drop "post_category" into the field that opened up.

csv-import-s2-2


Finally, open the "Other Post Options accordion to map the final bits of data. First, under "Post Dates" replace  the word "now" with "post_date." Then, drop "post_slug" into "Post Slug" and "post_author" into "Post Author." Note that you'll need to have already added all your authors as users for the "Post Author" name import to work. You should have something like this:

csv-import-s2-3

Click "Continue to Step 4". 

The tool needs a way to uniquely identify each post. Simply click "Auto-detect" and it should automatically find a unique value for you (likely "post_title"). Click "Continue. 

All Import: Step 5

You should see an import summary. If everything looks right, click "Confirm and Run Import". After a few seconds, you should see "Import Complete." Go to Posts from the Admin Sidebar to see all of your imported posts.

imported-posts

 

Congratulations, you just made yourself a CSV containing all of your HubSpot blog post data AND imported it into your fresh WordPress install!  πŸŽ‰ πŸŽ‰ πŸŽ‰

Editor’s Note: This post was originally published in December 2017. It was updated in December 2018 for accuracy and comprehensiveness.

New Call-to-action

Published on December 17, 2018

Γ—
3d-Cover.png

Form Tilte Here