How do I migrate a custom field from WordPress? I'm working on migrating a fairly large blog type site from WordPress into Druapl 7. The WordPress Migrate module has imported the basic blog content very well (title, body, tags, etc), however there were custom fields set up in WP that do not import.

Looking at the xml file, there's really just one extra piece of info I need. A line for a video file (which is a code for a youtube video). 

Here's how the code for this looks in the XML file:

    &lt;wp:postmeta&gt;
        &lt;wp:meta_key&gt;Video_File&lt;/wp:meta_key&gt;
        &lt;wp:meta_value&gt;&lt;![CDATA[8ENbMuVQCYE]]&gt;&lt;/wp:meta_value&gt;
    &lt;/wp:postmeta&gt;


I have decent PHP experience, but the only customizing I've done in Drupal are relating to themes. Can I write a little addition to the WordPress Migrate module to insert this extra piece of info? Since the module migrates everything else nicely can I create a new little module that would go through the same xml file, find the matching node (by post date/time, title, some distinguishing piece of info from the xml file) and then add in the video info (assuming I would first create another row in the DB table)?

I'm at a bit of a loss, and since I need to bring in close to 1000 posts (most of which have the video code), I really need to fine a solution that doesn't involve me editing every single node by hand to add in the dang code.

I should also mention I currently don't have a CCK field in Drupal for the video code... that just dawned on me, so I'm off to create one and then re-migrate a portion of the blog (I downloaded it in multiple xml files for testing).

Update: Created that CCK field, re-imported the blog, and sadly it didn't work :) Not that I thought it would to begin with (nothing is ever that easy).



Update: I've been attempting to modify the WordPress Import module with little success thus far. This meta field is just some text, so I'm hoping to figure out where to add in the info I need to have it process correctly. I'm sure I need to tell it which cck field to insert the new data, just have to find it!



Another Update:
Working on adding a WP plugin to export all the content as a CSV, then going to use the Feeds module to attempt to import everything.

My backup is going to be to use the wordpress_migration module to import the basic stuff (title, body, tags, etc), then write a custom php page to add the video links... I'm basically thinking to find the title in the node table, grab the nid, then create the entry in the video_field in the db table. At least that's how it's currently laid out in my head, whether or not that works in real life remains to be seen.

Course hopefully Feeds works just fine and I won't have to try the backup!
Neat. It looks like wordpress is storing a small fragment of the youtube url in the DB. I'm not sure how the the cck video field stores content -- probably in its own field, and it probably has to be set for "Youtube" before you attempt a migration.

Once you figure out where the youtube ID will be stored in a drupal field. See the documentation on how to extend worpress migrate:


  
  Extend the appropriate class, such as the WordPressBlogEntry class with your custom behavior - add field mappings in __construct(),
  manipulate the body ($row->content) in prepareRow(), etc.
  Extend the WordPressBlog class, and override migrationClasses to point to your custom classes:
  


&lt;?php class MyCustomBlog extends WordPressBlog {
public function migrationClasses() {
    $classes = parent::migrationClasses();
    $classes['WordPressBlogEntry'] = 'MyCustomBlogEntry';
    $classes['WordPressPage'] = 'MyCustomPage';
    return $classes;
} }


In your custom migration class you would then define the migration of a field using a Mapping as something like:

 // dest (a field in the node) &lt;- source
 $this-&gt;addFieldMapping('youtube_url', 'source_yt_value');


In your custom migration class you will of course have access to the typical helper methods used in migrations to "prep" the data (retrieve the youtube url from that CDATA crud), and translate it into a valid video blurb for drupal.