Subscribe to THE LATEST

Quick Tip: How to Migrate Your Blog from WordPress to HubSpot

Quick Tip: How to Migrate Your Blog from WordPress to HubSpot Blog Feature

December 20th, 2013 min read

how-to-move-your-blog-from-wordpress-to-hubspotWordPress is one of the best CMS' out there, with thousands of features and plugins from every aspect.

Even with all of its features and customizable capabilities, it's still no HubSpot.

But...how do you go about migrating a high volume of blog posts from one platform to another? Sounds simple, right? Not so much. 

Now you could use the built in HubSpot Blog Importer Tool, it works just fine. However, we needed to migrate not just the content, but also thousands of featured images, custom read more tags, paragraph tags, and other formatting. 

With thousands of posts to migrate, we needed something to simplify the process as much as possible. (Imagine manually adding paragraph tags to over 2,000 posts??)

Luckily, we've gone through this arduous process and have a repeatable formula to make your transition over to HubSpot that much easier. 

First things first

You need FTP access to your domain that WorPress.org  (your blog) is installed and hosted on.

What's FTP (File Transfer protocol) Access? It's a standard network protocol used to transfer files from one host to another. Talk to your development team for more assistance on how to access it.  

Once you have access, you’ll need to install the Export Tool in WordPress if you haven’t already. (It's usually already installed.)

You can find this under the tools section in the left sidebar. (Pictured below.)

(Click to enlarge)

how-to-move-your-blog-from-wordpress-to-hubspot

The Code

Once you’re able to access the back end of your WordPress install, find the ‘export.php’ file located here: /wp-admin/includes/export.php.

Open that up in your text editor. (If you don’t have one, my favorite is SublimeText2.)

Now around line 377, find this line:

<content:encoded><?php echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) ); ?></content:encoded>

Replace it with this:

<content:encoded>
	<?php 	
	$dl = " ";
	$text_to_add="<!--more-->";
	$number_words=50; 
	$text=$post->post_content;
	$arr=explode($dl,$text,$number_words+1);
	$last=array_pop($arr);
	$more_content=implode(" ",$arr)." ".$text_to_add." ".$last;echo wxr_cdata( apply_filters( 'the_content_export' ) . wpautop( get_the_post_thumbnail( $size, $post_thumbnail_id ) . $more_content ));?>
</content:encoded>

Save that up and go back to the export tool in WordPress (refresh that page if you’re already on it).

Now just begin the export of your posts!

Tip: If you have a solid amount of posts, say more than 500 or so, I’d suggest breaking them into a few different files. The more posts, the more exports. 

What you just did will get you the featured image, tags around the text (because HubSpot won’t add those), AND get you a custom “Read More” link after 50 words.

Back in HubSpot

Now log in to HubSpot and go to Content > Content Settings.

Find “Blog Importer” in the left sidebar and simply upload the .xml file(s) that you have.

After their status reaches “ready,” you can go into that import file and begin importing the posts from that file.

Now you're ready to go! All of your old posts will carry over, and you'll be ready to blog on HubSpot in no time at all. (Well, depending on your internet speed of course.)

How to Drive More Traffic to Your Business Blog