I have several posts in an Microsoft Excel file (.csv/.xls). I want to know the appropriate format of the file to import into WordPress.com.
Note: I do not need help to convert the csv format into xml. I just need to know the required format for feeding into WordPress. Same approach should work for .org hosted blogs.
Currently I have extracted a WordPress XML file from WordPress with the necessary headers. I believe all I need to do is populate the below XML code for each new post.
What fields can be excluded? What fields can be left blank? An example of successfully imported file and code would be appreciated.
I have tried two imports into WordPress that have been confirmed as successful however I cannot see either post? So I suspect something is wrong with my file.
<Item>
<title> My Post Title </title>
<link> My Post URL </link>
<pubDate> Sun, 01 Jan 2012 00:00:00 +0000 </pubDate>
<dc:creator> Author </dc:creator>
<guid isPermaLink="false"> My Post WP URL </guid isPermaLink="false">
<description> My Post Description </description>
<content:encoded> My Post Content </content:encoded>
<excerpt:encoded> My Post Excerpt </excerpt:encoded>
<wp:post_id> My Post ID </wp:post_id>
<wp:post_date> 2012-01-01 00:00:00 </wp:post_date>
<wp:post_date_gmt> 2012-01-01 00:00:00 </wp:post_date_gmt>
<wp:comment_status> Open </wp:comment_status>
<wp:ping_status> Open </wp:ping_status>
<wp:post_name> My Post Title </wp:post_name>
<wp:status> inherit </wp:status>
<wp:post_parent> My Post Parent ID </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> </wp:attachment_url>
</Item>
Here is an import file where only a few settings are used (although you may be able to exclude even more), which successfully imports three posts (tested on WP 4.2.2):
If you just need a known-good example of a WordPress XML import file, try the Theme Unit Test data XML file.
If the code in your Excel file is well-formed, you may also look at other options, such as importing (X)HTML.
If you want to see how WordPress actually constructs its “Extended RSS” (XML) file, see
wp-admin/includes/export.php
.If you want to see how WordPress imports data, see
wp-admin/includes/class-wp-import.php
and the import plugin‘swordpress-importer.php
andparsers.php
.As for what data are actually required, I would assume that it is just anything that is a primary key in the database. But double-check the above two files to be sure.