Importing and Converting Xanga Blogs into WordPress

Information correct as of 23 March 2005

If you have an existing blog creating in Xanga, and are converting to use WordPress, you may wish to import the existing Xanga blog entries and copy them into the new blog.

Please use with care - it has not been tested for all situations

Please post comments into http://wordpress.org/support/topic.php?id=6303

Although Xanga creates an RSS feed - there appear to be problems with both the format and amount of information - it seems to only include the most recent posts.

The following is a workaround - please note it has been tested for my specific use of Xanga, which is a simple blog from one person, with no comments. Please take due care to ensure it works for you, and take a backup of you SQL database before using.

Note that there appears to be no clear title on Xanga blogs, so the posting date will be used as the title

1. Download the Source Forge XRIP project - note that this project is no longer supported and development was not completed, but it will work for this task.

http://sourceforge.net/projects/xrip/

2. Create a subdirectory on your server under the WordPress installation and upload the XRIP files and directories into it. Note the contents of changelog should be - Thu Sep 2 14:39:55 EDT 2004

3. Create a file import.txt and open it in a simple text editor

4. Run genmet.php from that directory.  It will prompt for the Xanga user/blog name and then creates output to the screen. If the blog is large, this may be a problem in the next step. Type CTRL+A to select all the text, then paste that into import.txt and save it.

5. At this point, you might want to cut and paste  a few posts from the start of import.txt and test importing those first.

6. Upload import.txt into the WordPress wp-admin directory

7. Copy wp-admin\import-mt.php to create import-mt-xanga.php. You will modify this second file

8. Changes to import-mt-xanga.php

After <?php
insert
# Modified version of import-mt.php to help import Xanga blogs

Change define('MTEXPORT', '');
to
define('MTEXPORT', 'import.txt');

Change all occurrences of import-mt.php to import-mt-xanga.php

Change
$importdata = preg_replace("/--------\nAUTHOR/", "--MT-ENTRY--\nAUTHOR", $importdata);
to
$importdata = preg_replace("/--------\nTITLE/", "--MT-ENTRY--\nTITLE", $importdata);

after case 'TITLE': ......
$post_name = sanitize_title($post_title);
insert
$post_status = 'publish'; 
$post_allow_pings = 'open';
$comment_status = 'closed';

after $post_content = addslashes($body . $extended);
insert
$post_content = str_replace('\r\n', '',$post_content);

after $comment_content = str_replace('-----', '', $comment_content);
insert
$comment_content = str_replace('\r\n', '', $comment_content);

after case 'DATE':
insert
$post_title = addslashes($value);
$post_name = sanitize_title($post_title);

All posts get inserted with category Xanga

to change that , after case 'PRIMARY CATEGORY':
change
$post_categories[] = addslashes($value);
to
$post_categories[] = whatever you want;

9. Upload this file import-mt-xanga.php and run it. Note that you must choose to replace all the user names which look something like \r\n<head>\r\n <title id=\ - since the format otherwise will be wrong