Once I promised to release the script that I wrote while migrating from Nucleus CMS to WordPress. Well, here it is. But I doubt that you should start any serious celebrations, since this one is pretty messy and based very much on my setup. Let me try to explain a couple of things to make it easier for you.

Expectations (read: limitations):

  • This script expects that all your Nucleus tables have nucleus_ prefix and all your WordPress tables have wp_ prefix. These are the defaults anyway, so I don’t think this is much of a problem.
  • This script expects that all your Nucleus tables and all your WordPress tables are located in the same database. And I really don’t see the reason to separate them anyway. You’ll just delete Nucleus tables after migration.
  • This script expects that your WordPress upload directory is /wordpress/wp-content. This is again one of WordPress defaults, so I don’t think it will matter much.
  • This script expects that inline images in your Nucleus posts were surrounded by the <div class="leftbox">...</div> and <div class="rightbox">...</div>. If you had it differently, you’ll have to play with regexps.
  • This script expects that all authors who posted items in Nucleus have the same username (aka login) in WordPress. Since I was and will be the only user posting items, that was pretty easy for me.
  • This script expects that all categories that existed in Nucleus have the same name in WordPress. It does not create these, since WordPress has a more advanced cateogory functionality (with nesting and stuff), so you’ll have to deal with this.
  • This script does not create slugs (short-names-with-hyphens) for WordPress items, so if you are using post titles in your permalinks, they won’t work. I was (and still am, for that matter) fixing this with a bunch of other tiny script which I won’t post here for their uglyness. Find your own solution or don’t use post items in the permalinks.

Features (read: things I cared about)

  • This script migrates Nucleus posts to WordPress. NOTE: Nucleus uses two database/forms fields for the post body and extended part (aka ‘Read more’). WordPress has only body in database/forms, but provides a <!--more--> tag to separate the post in parts. My script is using this tag when combining Nucleus post parts into WordPress single post.
  • This script can migrate either all posts or posts written after the certain date.
  • This script migrates Nucleus comments to WordPress. This script will use Nucleus members information (names, URL, email) and information that was provided via comment submission form smartly. Well, as smart as works for me. :) Comments are assigned to posts based on the post time AND post title. This should be right most of the times.
  • This script tries to be as verbose as possible during the migration process, so that you always know what it does. (I consider this to be more of a feature than a limitation.)

Once again, remember that this script wasn’t written to work for the general public, since the amount of customization that can be (and usual is) done to both Nucleus CMS and WordPress is enormous. I wrote this script as a quick hack to help me with a one time task, so don’t expect much. If things go wrong, check the regexp bits first, and the SQL bits second.

Without further ado:

P.S.: If comments in the script appear strange or incorrect, consider the fact that I wrote them few days after I wrote and used the script itself…

Update: If you used this script, you might be also interested in Fixing WordPress slugs post.

55 thoughts on “nucleus2wordpress”

  1. I updated the script for WordPress 3.3x and Nucleus 3.6x, will probably work with WP versions after 3.x

    Added more compatibility,
    Fixed proper comment importing,
    Added user import
    Updated all database tables properly.

    Works great!

Leave a Comment