Converting a Site To WPMU

I have a lot of WordPress sites I manage and I’ve been thinking about converting them to WordPress MU sites to consolidate management. Today I attempted the first one, There’s no proper way of doing it that I found, but here’s what I did:

  • Create a new site in MU
  • Create the users in the correct order (user ID numbers must match)
  • Replace the posts, postmeta, comments, terms, term_taxonomy, and term_relationship tables with those from the original blog
  • Copy the contents of wp-content/uploads to wp-content/files
  • Update the posts table with the new path (both for regular content and attachments, see below)
  • Hope it all worked

Somebody is likely to say “just export the content in WordPress XML format and import it in the new blog,” but that person doesn’t use permalinks based on post_id. Doing the export/import dance destroys post_id-based permalinks, and that’s a bad thing™.

The MySQL queries to update the posts with the new upload location:

  • for “regular content”
    UPDATE {new_posts_table}
    SET post_content = REPLACE(post_content, '/wp-content/uploads/', '')
    WHERE post_content LIKE '%/uploads/%'
  • for the attachments
    UPDATE {new_posts_table}
    SET guid = REPLACE(guid, '/wp-content/uploads/', '')
    WHERE guid LIKE '%/uploads/%'

3 thoughts on “Converting a Site To WPMU

  1. Pingback: WordPress blogok importálása WordPress MU-ba at élet és könyvtár

  2. Pingback: How to Convert a WordPress Blog into WordPress MU | Wordpress Arena

Comments are closed.