Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match existing terms when possible. #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions class-wxr-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down