Posted by cmb | Posted in Site Stuff | Posted on 27-05-2007
Tags: b2evolution, movable_type, wordpress
There already exist PHP scripts that can import b2evolution databases into a Wordpress blog, but I personally did not find them to be a satisfactory solution. This is due to the fact that the version of the PHP script you require depends critically upon both the version of b2evolution you are running and also the version of Wordpress into which you are importing (the script has currently not been updated in nine months and is incompatible with all recent b2evolution installs). Additionally it is necessary to install b2evolution and Wordpress into the same database, which is not easy if you are, for example, importing your posts into an already existing blog, or moving site entirely. Finally I don’t really understand databases and as such don’t feel happy in running a script I found on the internet to make massive changes, since if something goes wrong I do not stand a chance at fixing it.
Here I present a method that should work on all versions of Wordpress and all relatively recent b2evolution installs. You will not need to mess around with databases since we use an alternative approach. We are going to skin b2evolution in such a way that if you look at the source of a webpage it appears in a simple format that Wordpress can import, the Movable Type ASCII export format. With no further ado here are the three easy steps you need to perform to move your posts and comments from b2evolution to Wordpress:
1. Apply a new skin to b2evolution
BACKUP YOUR CURRENT SKIN. I’m not responsible if you forget to do this and then change your mind about moving over. Copy the following files over your current theme:
replace _main.php with the contents of _main.php.txt
replace _feedback.php with the contents of _feedback.php.txt
If you now view the blog in a browser it will look like a bit of a mess, but if you view the source of the page (click View > Page Source in your browser) it is in Movable Type ascii export format, which you can import directly into a new (or old) Wordpress install!
2. Download your old blog to text files
I found that the easiest way to grab a whole lot of posts at once was to view the archive page for a whole year, with the display of comments enabled. For example if your blog resides at http://www.mydomain.com/blog/ then the page that will show you all of the posts and comments for the year 2007 is at:
http://www.mydomain.com/blog/index.php?m=2007&c=1
View the source of this page (View>Page Source in your browser) then copy and paste it into a text file. Repeat this step for every year of posts you need to import.
3. Import the text files to Your New Blog
Wordpress
New versions of Wordpress can import directly from the admin control panel, just click “Manage>Import>MovableType and TypePad”. Upload your text files and click import. Older versions of Wordpress already have well written instructions on this page.
Typepad
I have heard that this works, but do not know how to do it…
Bugfixes For Older Software Versions
b2evolution 0.9.0
“author()” isn’t recognized by this version (or at least, the blog I am working with), but if it is replaced with “Author->prefered_name()”, everything works out fine! (thanks Layne)
Questions, comments and criticisms are, as always, welcome below.

The new blog is nice!
But now that you’ve got multiple people posting, could you put an ‘author’ field somewhere?
Thank you very much. You saved my day
[...] to migrate from b2evo to WP. Many things need to be done manually. I used the method explained in here to import the blog posts and coments. But that was really not a smooth [...]
Max: Thanks!
Also I just added the author tag, but it seems that everybody else has given up posting once again.
when we tried this, it worked fine, except all the posts (230 of them in that round) showed up as drafts in wordpress (they were published on b2evolution) Any advice?
Oops, in _main.php after the line containing “… DATE: ….” add a new line:
echo “STATUS: publish\n”;
Sorry about that!
Thanks. Just glad we got that bug fixed (and that I spotted it BEFORE I saved all those files without that line, and before 5000 posts went up as drafts . . . *shudders just at the thought* Now it seems to work fine, and in my guessing at what the problem was before you posted this, I actually got the missing code right, but put it after category, and WP still recognized it and actually published my import files
[...] script – just used this – piece of cake – though remember to rename those .php.txt files to .php How to Import b2evolution Posts to Wordpress – I tried using this, but I couldn’t get it to work – however, it seems more targeted at more [...]
Thank you for making this easier!
One thing I’d like to point out is that I ran into a small problem that is easily fixable. The b2evolution I am working with is version 0.9.0.12.
“author()” isn’t recognized by this version (or at least, the blog I am working with), but if it is replaced with “Author->prefered_name()”, everything works out fine!
Just switched over the entire 3 years of blogging to Workpress using this tool, much faster and no-headaches of Database manipulation! Great workaround!!
[...] to the curb as well. In the process of getting my posts transferred over I came across this guide which made the transition [...]
Well, I wish I could say that it worked seamlessly for me. It imported only partially and as one long comment, no posts. I probably did something wrong. This is my third try to convert my blog and I’m about ready to give up.
Diane, if you send me a copy of the text file you created then I can probably find the problem quickly enough. Not really much anybody can do to help with the information you’ve given us so far!
Hmm, I’ve tried going through the steps again. The thing is that the blog never looks “a bit of a mess”, so I’m wondering if the two files that are supposed to strip the skin are not working correctly, or if I’m doing something wrong. The comments are stripping down, but not the posts.
I posted the archive list I’m getting as my website.
Thanks for that interesting approach. What about the different authors? I have 30 different writers and lots of articles written by them.
I understand that I have to create them in my wordpress from scratch. Should I do this before I use your method? Will the articles be connected to the author?
sorry for my bad english
Manuel: When you import to wordpress it should guide you through creating separate users for each account, I had five or so authors on my old b2evolution blog and they all imported perfectly
Diane: Something has definitely gone wrong there, it looks to me like you copied _feedback.php correctly, but did not update _main.php. When you correctly copy _main.php the page should look like absolute garbage (no graphics at all, no sidebar, just ascii text).
Could you try copying _mainphp.txt over your blog’s _main.php again (be sure that you rename it so it actually overwrites!). To make 100% sure that nothing is interfering, perhaps it would be a good idea to make a new theme containing ONLY my _main.php and _feedback.php files.
Wow – nice. I will try this then… and give a Feedback here
Once again, thanks for your effort – saving us DBchangeHaters trouble!
Thanks for you help. I changed the skin in the way you said and now I have it all imported. Thanks so much! I’m switching my links to the new blog now. This is terrific!
Great! It worked very well.
Does anyone know, how I can redirect old permalinks like:
index.php?title=this_entry_here&more=1&c=1&tb=1&pb=1
to my new permalinks: /%category%/%postname%
Its not so good, the old links get a:
“1 I really need an ID for this to work.”
and that´s it ;-((
Don´t get me wrong – the urls inside work ok, it´s linkage from outside, I´m talking about.
I don’t think that is easy to achieve, since the category names are not present in the b2evolution urls you can’t do a simple rewrite.
There should, however, be a possible workaround using mod_rewrite to redirect all requests for one of the missing pages with urls like this:
/index.php?title=post_title&more=1&c=1&tb=1&pb=1
To a page like this:
/?s=post_title
which will automatically perform a search on your blog and display the most relevant post. Hopefully in almost all cases this will be the post with the matching title!
Hell, that´s a great idea!
can you write down the code for that, please?
You would make my Day
And by the way – do you have a donation-button somewhere around? I would like to donate a little bit for your great tutorial.
Cheers,
Manuel
[...] 1. Auf der b2evolution Installation einen Skin installieren, der die Posts im Movable Type Format ausgibt. (Den Skin und die Anleitung gibt es hier) [...]
[...] content to “Movable type” and then import it into wordpress. The complete procedures on How to Import b2evolution Posts to Wordpress – worked [...]
I wasn’t reading the directions quite right at first and was about to give up but once I wised up and *duh* read everything it worked flawlessly! Thank you for saving 3 years of my hard work and wasted time!!
This is awesome!! Thank you. I’ve been having a lot of trouble with my b2evolution blog, and after a recent update which was supposed to fix everything, and which took me forever to get working, I finally decided it was time to migrate. I had no idea it would be so easy to do!! Thanks, your directions are flawless and the changeover was a breeze. I was sweating bullets as I deleted my b2evolution install even though I had backups, but my fears were unfounded!!
Thanks again.
[...] Mary’s Pad is now running on Wordpress, migrated successfully from b2evolution, thanks to cmb. And a big thanks to Kaki for giving me the heads up on my broken [...]
[...] es jemanden interessiert: Um von B2Evolution 0.9 nach Wordpress zu migrieren, empfiehlt sich dieser Ansatz. Nach ein paar Startschwierigkeiten hat das eigentlich ziemlich problemlos [...]
Does anyone know, how I can redirect old permalinks like:
index.php?title=this_entry_here&more=1&c=1&tb=1&pb=1
to my new permalinks: /%category%/%postname% why ..
I wasn’t reading the directions quite right
Does anyone know, how I can redirect old permalinks like:
index.php?title=this_entry_here&more=1&c=1&tb=1&pb=
emanden interessiert: Um von B2Evolution 0.9 nach Wordpress zu migrieren, empfiehlt sich dieser Ansatz. Nach ein paar ..
Does anyone know, how I can redirect old permalinks like
oes anyone know, how I can redirect old permalinks like
Good Works Thanks…
In _main.php, I had to insert the line: $more=1; just prior to the line $Item->content();
If I didn’t, the exported content only contained excerpts of the posts, i.e., the content before the “Read more” tag.
[...] a skin for your version of b2evo that makes it output Moveable Type format. I found such a skin here, although I think it is for pre version 2.0 installs. I didn’t work for me because I was on [...]
Thanks so much. I had to upgrade b2 0.6.1 to 1.10.3 first, but this method proved the easiest to move the information from there.