Migrate Drupal fields to WordPress as custom fields

While migrating Drupal to WordPress (following the guides on official page), I haven’t found any way to migrate Drupal “Fields” to WordPress as “Custom Fields”. Since I’m very new to Drupal, please suggest how can I do this. Any code samples, links or ideas to solve this issue will be appreciated.

Additional info:

  1. Drupal v6.28; WordPress v3.6;
  2. Please consider that I’m new to Drupal not the WordPress

Related posts

Leave a Reply

3 comments

  1. Looks like I developed a solution how to migrate Drupal Fields to WordPress as Custom Fields (post meta) :

    First, lets say that we’ve a custom Content Type under Drupal. Let say it has a “key” my_custom_type, then, if this Content Type has got Fields the database will have a table named

    `content_type_my_custom_type`
    

    This table will contains Fields related to this Content Type. For example:

        nid | vid | field_xxx_xxx | field_yyy_yyy | ...
        _______________________________________________
        10  |  1  | the_value_x01 | the_value_y01 | ...
        11  |  2  | the_value_x11 | the_value_y11 | ...
        11  |  3  | the_value_x12 | the_value_y12 | ...
        11  |  4  | the_value_x13 | the_value_y13 | ...
    

    where

    1. nid – node id (node UNIQUE id)
    2. vid – version id (current node revision’s UNIQUE id; there may be unlimited number of revisions per node)
    3. field_xxx_xxx – Field KEY

    The task is to move the Fields to existing WordPress post as this post Custom Field (post_meta).

    Considering the structure of $TABLEPREFIX_post_meta table in WordPress (thx to your answer, Chris) :

    1. meta_id – index
    2. post_id – ID of associated post
    3. meta_key – name of the field
    4. meta_value – value of the field

    , we can use this query:

    INSERT INTO wordpress.wp_postmeta
        (post_id, meta_value, meta_key)        
        SELECT 
            tt.nid `post_id`,
            tt.field_xxx_xxx `meta_value`,
            'field_xxx_xxx' `meta_key`  
            FROM drupal.content_type_my_custom_type tt
            INNER JOIN
                (
                SELECT nid, MAX(vid) AS MaxVID
                FROM temp.content_type_my_custom_type
                GROUP BY nid
                ) groupedtt ON tt.nid = groupedtt .nid AND tt.vid = groupedtt.MaxVID
    

    Clarification: we’ve making an insertion of 3 fields, where

    1. post_id equals to nid
    2. meta_value equals to field_xxx_xxx (replace for your)
    3. meta_key equals to string "field_xxx_xxx"

    We also making an inner join to select max vid value (latest revision).

    This method is not fully automated but works like a charm.
    Hope it helps!

  2. They’re stored in the WordPress database in the wp_postmeta table, with the following fields:

    • meta_id – index

    • post_id – ID of associated post

    • meta_key – name of the field

    • meta_value – value of the field

    I don’t know much about how Drupal stores its field data, but as long as there are post IDs, keys, and values, you can create a query to migrate it to WordPress.

  3. You might look at the WP Ultimate CSV Importer Plugin. This powerful tool allows the import of posts from a csv file, it also automatically creates categories and custom fields assigned to posts. Exporting tables from the database to a CSV file can be done in phpMyAdmin.

    I don’t know the structure of Drupal database, so i don’t know how much this helps, but this tool has helped me in similar situations.