How to import your blog into wordpress

If you already have an existing blog on the well known sites like blogger, livejournal, typepad etc, you will easily be able to import your blog into wordpress. However if like me, you have a custom Content Management System (CMS) but need getting the data into wordpress, then things get a bit tricky.

Here’s the WordPress Importer for custom CMS or blog

Initially when I created my own CMS, I did that because I wanted more control over things. I wanted to do things my own way and then there’s the sense of achievement that you’re running your own blog and you’re not like everyone else using wordpress or another famous blogging platform. However php is not really my cup of tea. Yes I can code in php but I don’t really like it. I prefer C# and after converting my CMS to .NET, I decided I no longer wanted to maintain the codebase for the CMS coded in Php. I chose wordpress as my blogging platform because I’m more familiar with it and there’s tons of plugins nowadays to do just about anything and there’s loads of themes to choose from (and they’re free!!!) and the platform is well maintained and secure. I couldn’t convert them to .NET because I’d need Windows server to run them on and let’s face it, Linux is much cheaper and more available than Windows.

So the time comes for me to convert my existing CMS to wordpress and because it my a tailor-made CMS, I have to do a manual conversion. There are 2 options for that:

Use a database script

When wordpress has been installed, the database and tables would have been created. You can look at the table definition and insert records for the posts and comments from your old tables. The database script would copy the records for the posts and comments to a temporary (holding) table and then insert the data into wordpress tables.

I decided not to go down this path because I would need to properly analyse the tables in wordpress before I was sure I was putting data into the correct fields and not breaking any constraints or relationships.

Use the WordPress eXtended RSS file format (WXR)

This is similar to an RSS file which is an xml document with the posts and comments. All you have to do is create this xml file and go to wordpress and from Tools->Import, you will get the option to upload the WXR xml file and all your posts and comments will be copied over to your new wordpress blog.

This was a better way for me to convert my old blog to wordpress. I made an ASP.NET Http Handler create the xml file for me to use on the new blog. You will have to understand what elements are required in the WordPress file format for a successful import though. I was worried about something though – I have a page title and a page subject as well as a description field for any given webpage. I wanted to preserve these when moving over to wordpress and since the subject line and title did not match, it can have drastic effect in terms of SEO. However when the import was done, I had to enable a plugin (Platinum SEO pack) and the titles and subject were displayed correctly. Note that the wordpress importer is a plugin which needs to be installed before you can upload your WXR file to import your old blog.

For those interested, I’ll be posting the code for generating the wordpress xml file (WXR format). Code already posted above!

comments powered by Disqus