Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am renovating an old site that has a messy custom post type. Over the years, it has accumulated redundant fields and taxonomies. I have replaced it with a new CPT that reflects the client's current business logic, and now I need to migrate the old data to the new format.

This is the process I have in mind for migrating the post metadata:

  1. Add both old and new CPT and related taxonomy definitions to a blank theme.
  2. Output meta data and taxonomy terms for a sample of the old posts, and for an example of a new post. Look for patterns, and build up a $migrationMap array, where each element is Relation object:

    Relation

    • $oldKey
    • $newKey
    • function translate( $oldVal ) -> $newVal
    • (optional) function verify( $oldVal, $newVal ) -> $ok
  3. Dry run: Loop over the old CPT and make sure that all verify funtions pass. var_dump the output, a translated version, of each post, and make sure it looks good.

  4. Do it again, but this time run the outputs through wp_insert_post to complete the migration of the CPT data.

And then, repeat the process for taxonomies.

Has anyones else done this? Does anyone know if there is a simpler / easier way?

share|improve this question
2  
Nope, stuff like this is almost always such semi-manual migration. –  Rarst Mar 17 at 19:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.