Migrating from b2evolution to WordPress

Tutorial

The migration principle is rather simple:

  • You have to export the blog content in a MovableType format with the skin I created : _MtExport
  • You need to tidy it up a bit.
  • You import it in WordPress with its import tool
  • You smile

I had to create a skin to be able to export most of the blog data. Previous existing plugins were either useless nor downloadable. So I tried to match most of the Movable Type specifications:  Movable Type import/export format. _MtExport can export :

  • AUTHOR
  • TITLE
  • BASENAME
  • DATE
  • STATUS
  • ALLOW PINGS
  • ALLOW COMMENTS
  • PRIMARY CATEGORY
  • CATEGORY: (Toutes les autres)
  • KEYWORDS: (les tags)
  • BODY

About the comments, they are present and their important fields too :

  • COMMENT:
    • AUTHOR
    • EMAIL
    • DATE
    • URL
    • IP

Rather complete ? So, dive into this guide to know the rest and download the skin  _MtExport.

Previous work

Backup by the way you like your b2evolution and WordPress database. Try, as much as possible, to upgrade your b2evolution to the latest version. This tutorial was written with the 4.1.2 version. Disable any plugin that adds too much output in the html. I’m thinking of addons like “Sociable”, “Creative Common” or “Digg”. Those addons are weighting the output and the real content with something you’ll be able to recreate with WordPress addons. Also, try to have your permanent urls formatted like WordPress can also manage. Mines look like the classical /<Year>/<Month>/<Day>/<Permalink> . You’ll see all the interest as my skin corrctly outputs the permalink to be reused as-this in WordPress. So, you can preserve all your blog post urls after the migration.

Skin

The first thing to do is to download the skin from le link above and install it in the b2evolution skin folder. Just uncompress the archive and upload the folder called  _MtExport. [Download not found] You can also get or reuse this project under a CeCILL-B open-source licence. Sources are available on my github : https://github.com/FrenchW/MtExport Then, in the administration ipages, just enable the skin ans follow the test url: http://<YourBlog>/?tempskin=_MtExport In the case your blog counts more than 500 posts, you’ll have to edit the file “index.main.php” from the skin folder and change the value at line #3 (equal in the case of more than 500 comments) :

$MaxItems = 500;

Transfer media contents

Your b2evolution installation contains images and medias uploaded due to content creation. If all went well, those files might be in the folder : /media/blogs/<YourBlogName>/ Transfer all those files and the directory structure as-is in your new WordPress installation. I put all the old content in a /wp-content/uploads/old_b2/ folder not to have the old content mixed with the future one to be created by WordPress.

Changing those links

Once you have your old posts exported in the MovableType format by the use of the link http://<YourBlog>/?tempskin=_MtExport, you have to copyil faut copier/coller le contenu dans un nouveau fichier texte que vous nommerez “mt-export.txt”. Avec votre éditeur de texte préféré, faites rechercher/remplacer et modifiez tous les liens de média. J’ai donc, suite aux url que je vous ai donné, remplacé “/media/blogs/FrenchW/” par “/wp-content/uploads/old_b2/”. Enregistrez le fichier en faisant très attention qu’il soit enregistré en encodage UTF-8. (j’ai eu des soucis avec l’ANSI que me sortait par défaut Textpad)

Cleaning WordPress

The following SQL script cleans up any post in a wordpres site. BEWARE : it only preserves saved and published pages.

TRUNCATE FW_wp_comments ;
TRUNCATE FW_wp_commentmeta ;
TRUNCATE FW_wp_postmeta ;
DELETE FROM `FW_wp_posts` WHERE `post_type` <> 'page';
TRUNCATE FW_wp_terms ;
TRUNCATE FW_wp_term_relationships ;
TRUNCATE FW_wp_term_taxonomy ;

Save your cleaned database to help you go back later.

Import in WordPress

Finally, here is the easiest part: Start by creating the writer accounts you had on the former blog. Then, in Tools/Import, select Imp1 “Movable Type and TypePad” and accept. Imp2 The importer will ask you the path of your file mt-export.txt. (Note that, if the file exceeds 1mb, you’d better upload if in the /wp-content/ folder of your blog). First, it’ll ask you to map former and existing authors

Imp3 Next, he’ll do the magic : creating Categories, tags and comments. That’s why it is important to have an empty wordpress (see SQL script below). It is now done, you should have backed up all your previous content from b2evolution to WordPress. You should now do another backup of your database.

Don’t forget to drop a comment 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.