WordPress Conversions

This post is mainly for WordPress junkies and those of us who are inveterate curiousity hounds.

In the new HOME department I announced yesterday – seems longer ago – that the consolidation of the old “What’s New” WP installation into the new HOME installation was complete. And so it seemed.

While checking out the functionality, I discovered that Alex King’s nifty plugin “Articles” had gone haywire. Half of the imported posts were showing up in Astronomy, for example. I checked my Categories, I checked mySQL. Most of the listings showed no traceable cause or pattern.

The immediate patch was to dump “Articles”. The thing is, whether you like Categories or Tags (I use both), there doesn’t seem to be another utility anywhere that lists all your posts in list form.

Without “Articles”, you can already see your posts sorted by Archive (month and year), or by Category. But you get a short description (Excerpt) or the full text, one or the other, depending on your settings. A mature site can output an overwhelming number if pages of “summaries”. That’s what “Articles” circumvents.

If you’re going to be mucking about in the WP databases, I also recommend adding tag define(‘WP_POST_REVISIONS’, false); to your wp_config. I’d see Lester Chan’s article on this and his SQL to remove existing duplicatative post revisions.

WHAT I DID WRONG: Thinking wp_posts contains category information, I used info on the WordPress Codex to export “What’s New” as RSS XML. I can’t say there’s anything wrong with this so far, but what I can say is the HOME imports frequently matched up to category id’s I didn’t assign. I think that’s because I didn’t delete the old categories. As you know, WP mySQL is a relational database. I think some of those old wp_postmeta links that I didn’t delete matched up to the imported new post id’s (which I didn’t edit to guarantee uniqueness – too many of them!)

The problem only manifests itself in the ‘Articles’ plugin. Everything else works fine. Alex King apparently stopped updating Articles around WP ver 2.5, but his excellent utility still works fine in all the other 2.71 installations. I concluded the problem HAD to be in my postmeta.

REMEDY: I created a new test database, cloned the HOME WP php files installation to a new test directory, and initialized the new WP installation. I then imported a copy of all original wp_posts into it, because I was finally satisfied that the relational match is on post ID only.

In writing this article, I am now taking a break from updating all the posts in the test region manually, reassigning new categories and tags which will now (a) match the correct meta_id’s, of course, and (b) NOT match any junk meta left over from earlier installations.

Too bad, but I edited all the posts manually before, deleting unwanted categories and adding or re-adding the appropriate ones. This doesn’t physically delete the old metas, just relinks the post id’s to the new meta – leaving duplicative junk around for ‘Articles’ to get tangled up in.

I could find no info on “rebuild” – that’s laughed at as an old kludge for Movable Type.

So, the only workaround I know is a clean install and manual rebuild. You can import posts and links through mySQL to save a LOT of time. You can clone the entire php installation. You set up the new site admin and connections manually – this should be second nature by now. But, it seems, you need to build the new categories and cat links manually.

Once I have my clone HOME site working exactly like the production model, I’ll export the whole thing with mySQL, DELETE the entire HOME database, create a new empty database, and import my SQL file into it. Delete and reload takes under 60 seconds, so you can probably get away with this during daytime hours on low and medium volume installations.

This sounds like a lot of work to support a plugin. Gnawing in the back of my mind was the knowledge that, somewhere, my HOME database was corrupted. So, if the new experiment works, it’s worth it.

And it’s one heck of a lot easier than rebuilding 109 HTML pages if a Dreamweaver template goes south.

1,081 total views, 2 views today

3 thoughts on “WordPress Conversions

  1. Very clever. I have the same problem, but I didn’t have enouge knowledge to even try to do this, but I think that based on your article I will do it right.

  2. Thanks – though my solution is 100% old fashioned grunt work. Re-reading my post, I think the most important things are (1) setting up exact matches for all your categories in advance in the test installation, and (2) getting the database names right the first time. Exporting the old database to an sql file, you can use find/replace in a programming text editor, on a COPY of the exported file, before importing into the test installation. I used Homesite (which is hopelessly obsolete and unsupported) but am currently testing Komodo (I like it) and may try TextMate if not too much editor for my needs.

    Be patient, take your time, check your work — and good luck!

Comments are closed.