diff --git a/class-wxr-importer.php b/class-wxr-importer.php index 51c6a80..55d313e 100644 --- a/class-wxr-importer.php +++ b/class-wxr-importer.php @@ -917,8 +917,13 @@ protected function process_post( $data, $meta, $comments, $terms ) { $taxonomy = $term['taxonomy']; $key = sha1( $taxonomy . ':' . $term['slug'] ); + // Add terms that were processed earlier in WXR import. if ( isset( $this->mapping['term'][ $key ] ) ) { $term_ids[ $taxonomy ][] = (int) $this->mapping['term'][ $key ]; + // Add terms that already exist on the site. + } else if ( $existing_term_id = $this->term_exists( $term ) ) { + $term_ids[ $taxonomy ][] = $existing_term_id; + // Add the term info as post meta for manual relinking. } else { $meta[] = array( 'key' => '_wxr_import_term', 'value' => $term ); $requires_remapping = true;