Index: /trunk/wp-admin/import/wordpress.php
===================================================================
--- /trunk/wp-admin/import/wordpress.php (revision 6128)
+++ /trunk/wp-admin/import/wordpress.php (revision 6129)
@@ -89,4 +89,5 @@
$this->posts = array();
$this->categories = array();
+ $this->tags = array();
$num = 0;
$doing_entry = false;
@@ -100,4 +101,9 @@
preg_match('|(.*?)|is', $importline, $category);
$this->categories[] = $category[1];
+ continue;
+ }
+ if ( false !== strpos($importline, '') ) {
+ preg_match('|(.*?)|is', $importline, $tag);
+ $this->tags[] = $tag[1];
continue;
}
@@ -244,4 +250,25 @@
$cat_ID = wp_insert_category($catarr);
+ }
+ }
+
+ function process_tags() {
+ global $wpdb;
+
+ $tag_names = (array) get_terms('post_tag', 'fields=names');
+
+ while ( $c = array_shift($this->tags) ) {
+ $tag_name = trim($this->get_tag( $c, 'wp:tag_name' ));
+
+ // If the category exists we leave it alone
+ if ( in_array($tag_name, $tag_names) )
+ continue;
+
+ $slug = $this->get_tag( $c, 'wp:tag_slug' );
+ $description = $this->get_tag( $c, 'wp:tag_description' );
+
+ $tagarr = compact('slug', 'description');
+
+ $tag_ID = wp_insert_term($tag_name, 'post_tag', $tagarr);
}
}
@@ -392,4 +419,5 @@
$this->get_entries();
$this->process_categories();
+ $this->process_tags();
$result = $this->process_posts();
if ( is_wp_error( $result ) )