WXR? Export from Drupal 7 – import into WordPress

Importing in WordPress per default uses the WXR Format – which is what is importable using the default WordPress importer plugin that you can use via

Admin
>> Tools
>> Import
>> WordPress

As there (IIRC) is no Drupal export standard, you will have to convert your content into the WXR format. To export in the needed format, you will have to ask at [drupal.se].

WXR basically looks like this:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
     xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wp="http://wordpress.org/export/1.2/"
    >

    <channel>
        <title>Your title</title>
        <link>http://example.com</link>
        <description>Foo</description>
        <pubDate>Wed, 20 Mar 2014 12:09:12 +0000</pubDate>
        <language>en-US</language>
        <wp:wxr_version>1.2</wp:wxr_version>
        <wp:base_site_url>http://example.com</wp:base_site_url>
        <wp:base_blog_url>http://example.com</wp:base_blog_url>

        <wp:author><wp:author_id>1</wp:author_id><wp:author_login>manovotny</wp:author_login><wp:author_email>[email protected]</wp:author_email><wp:author_display_name><![CDATA[Michael Novotny]]></wp:author_display_name><wp:author_first_name><![CDATA[Michael]]></wp:author_first_name><wp:author_last_name><![CDATA[Novotny]]></wp:author_last_name></wp:author>
        // ... repeat ...

        <wp:category><wp:term_id>107</wp:term_id><wp:category_nicename>alignment</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Alignment]]></wp:cat_name><wp:category_description><![CDATA[Posts in this category test image and text alignment.]]></wp:category_description></wp:category>
        // ... repeat ...
        <wp:tag><wp:term_id>132</wp:term_id><wp:tag_slug>8bit</wp:tag_slug><wp:tag_name><![CDATA[8BIT]]></wp:tag_name><wp:tag_description><![CDATA[Tags posts about 8BIT.]]></wp:tag_description></wp:tag>
        // ... repeat ...
        <wp:tag><wp:term_id>129</wp:term_id><wp:tag_slug>articles</wp:tag_slug><wp:tag_name><![CDATA[Articles]]></wp:tag_name><wp:tag_description><![CDATA[Tags posts about Articles.]]></wp:tag_description></wp:tag>
        // ... repeat ...
        <wp:term><wp:term_id>144</wp:term_id><wp:term_taxonomy>nav_menu</wp:term_taxonomy><wp:term_slug>long-menu</wp:term_slug><wp:term_name><![CDATA[Long Menu]]></wp:term_name></wp:term>
        <wp:term><wp:term_id>145</wp:term_id>

        <generator>http://wordpress.org/?v=3.5.1</generator>

        <item>
            <title>canola2</title>
            <link>http://wptest.io/demo/post-format-gallery/canola2/</link>
            <pubDate>Mon, 10 Jan 2011 13:17:54 +0000</pubDate>
            <dc:creator>manovotny</dc:creator>
            <guid isPermaLink="false">http://wptest.io/demo/wp-content/uploads/2011/01/canola2.jpg</guid>
            <description></description>
            <content:encoded><![CDATA[]]></content:encoded>
            <excerpt:encoded><![CDATA[Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec mollis. Quisque convallis libero in sapien pharetra tincidunt. Aliquam elit ante, malesuada id, tempor eu, gravida id, odio. Maecenas suscipit, risus et eleifend imperdiet, nisi orci ullamcorper massa, et adipiscing orci velit quis magna.]]></excerpt:encoded>
            <wp:post_id>611</wp:post_id>
            <wp:post_date>2011-01-10 06:17:54</wp:post_date>
            <wp:post_date_gmt>2011-01-10 13:17:54</wp:post_date_gmt>
            <wp:comment_status>open</wp:comment_status>
            <wp:ping_status>closed</wp:ping_status>
            <wp:post_name>canola2</wp:post_name>
            <wp:status>inherit</wp:status>
            <wp:post_parent>555</wp:post_parent>
            <wp:menu_order>0</wp:menu_order>
            <wp:post_type>attachment</wp:post_type>
            <wp:post_password></wp:post_password>
            <wp:is_sticky>0</wp:is_sticky>
            <wp:attachment_url>http://wptest.io/demo/wp-content/uploads/2011/01/canola2.jpg</wp:attachment_url>
            <wp:postmeta>
                <wp:meta_key>_wp_attached_file</wp:meta_key>
                <wp:meta_value><![CDATA[2011/01/canola2.jpg]]></wp:meta_value>
            </wp:postmeta>
            <wp:postmeta>
                <wp:meta_key>_wp_attachment_metadata</wp:meta_key>
                <wp:meta_value><![CDATA[a:5:{s:5:"width";i:640;s:6:"height";i:480;s:4:"file";s:19:"2011/01/canola2.jpg";s:5:"sizes";a:3:{s:9:"thumbnail";a:4:{s:4:"file";s:19:"canola2-150x150.jpg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:19:"canola2-300x225.jpg";s:5:"width";i:300;s:6:"height";i:225;s:9:"mime-type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:19:"canola2-624x468.jpg";s:5:"width";i:624;s:6:"height";i:468;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:10:{s:8:"aperture";d:5.5999999999999996;s:6:"credit";s:0:"";s:6:"camera";s:18:"Canon PowerShot G2";s:7:"caption";s:0:"";s:17:"created_timestamp";i:1094915268;s:9:"copyright";s:0:"";s:12:"focal_length";s:7:"16.8125";s:3:"iso";i:0;s:13:"shutter_speed";s:9:"0.0015625";s:5:"title";s:0:"";}}]]></wp:meta_value>
            </wp:postmeta>
            <wp:postmeta>
                <wp:meta_key>_wp_attachment_image_alt</wp:meta_key>
                <wp:meta_value><![CDATA[canola]]></wp:meta_value>
            </wp:postmeta>
        </item>
        // ... repeat ...

    </channel>
</rss>

Example extracted from the WPTest.io GitHub repository.

You will to alter the output to this, but basically it should not be a problem. You could also fetch the import from a RSS-Feed (just had finished a plugin doing that), but it is far more work than altering the output in Drupal as there are modules for that. Keep in mind that it is extremely important to get the namespace right. Else you will fail gracefully.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)