Posted by Michael Alfaro on April 14, 2011

WordPress WXR Importer only imports first item

Been trying to move content from various systems into wordpress and I immediately looked into plugins and the builtin WXR import to help me out.  So for the import, I figured let me see what a WXR export looks like, replicate it with my data, and import.  Worked pretty good once I got the data setup right, but ran into the issue that it would only import the 1st item in the XML file.  The export file looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:excerpt="http://wordpress.org/export/1.0/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.0/"
>
<channel>
<wp:wxr_version>1.0</wp:wxr_version>
<item>
	<title>test1</title>
	<dc:creator><![CDATA[admin]]></dc:creator>
	<wp:status>publish</wp:status>
	<wp:post_type>post</wp:post_type>
</item>
<item>
	<title>test2</title>
	<dc:creator><![CDATA[admin]]></dc:creator>
	<wp:status>publish</wp:status>
	<wp:post_type>post</wp:post_type>
</item>
</channel>
</rss>

What’s funny about the issue, is that the problem was that the XML declaration from the export was wrong!  It should have been like this:
<xml version="1.0" encoding="UTF-8">
I found the solution here: http://wordpress.org/support/topic/wxr-importer-only-imports-first-item

Topics: , ,

Add a Comment