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:
- Drupal v6.28; WordPress v3.6;
- Please consider that I’m new to Drupal not the WordPress
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 namedThis table will contains Fields related to this Content Type. For example:
where
nid
– node id (node UNIQUE id)vid
– version id (current node revision’s UNIQUE id; there may be unlimited number of revisions per node)field_xxx_xxx
– Field KEYThe 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) :meta_id
– indexpost_id
– ID of associated postmeta_key
– name of the fieldmeta_value
– value of the field, we can use this query:
Clarification: we’ve making an insertion of 3 fields, where
post_id
equals tonid
meta_value
equals tofield_xxx_xxx
(replace for your)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!
They’re stored in the WordPress database in the
wp_postmeta
table, with the following fields:meta_id
– indexpost_id
– ID of associated postmeta_key
– name of the fieldmeta_value
– value of the fieldI 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.
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.