Migrar de drupal a wordpress

Para migrar de drupal a wordpress es posible utilizar las sentencias SQL que indico al final del post. Las he sacado de otra web cuyo link he perdido y he hecho algún pequeño retoque.

Se pierden los usuarios y las relaciones artículos/comentarios – autores. El resto se conserva.

Las sentencias suponen que estamos trabajando sobre la BD de wordpress y que la base de datos de drupal se llama precisamente “drupal”:

delete from wp_categories ;
delete from wp_posts;
delete from wp_post2cat ;
delete from wp_comments ;

insert into wp_categories(cat_ID,cat_name, category_nicename, category_description, category_parent) select term_data.tid, name, name, description, parent from drupal.term_data, drupal.term_hierarchy where term_data.tid=term_hierarchy.tid ;

INSERT INTO wp_posts(
ID, post_date, post_content, post_title, post_excerpt, post_name, post_modified
)

SELECT nid, FROM_UNIXTIME(created), REPLACE(body, '--break--', '--more--'), title, teaser, concat("OLD",nid), FROM_UNIXTIME(changed) FROM drupal.node WHERE type="blog" OR type="page" OR type="story" ;

INSERT INTO wp_post2cat (post_id,category_id) SELECT nid,tid FROM drupal.term_node ;

INSERT INTO wp_comments (
comment_post_ID, comment_date, comment_content, comment_parent
)

SELECT nid, FROM_UNIXTIME(timestamp), concat("",subject, "", comment), thread FROM drupal.comments ;

Leave a Reply

Your email address will not be published. Required fields are marked *