Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
implements #441 allow taxonomy slugs to be the same in different lang…
Browse files Browse the repository at this point in the history
…uages

synchronise taxonomies by id rather than slug in case the slugs are the
same in different languages
  • Loading branch information
Jon007 committed Jul 14, 2019
1 parent 5b45d75 commit 9933b27
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Hyyan/WPI/Product/Meta.php
Expand Up @@ -406,17 +406,17 @@ public function copyTerms($old, $new, $lang, $taxonomies)
if (pll_is_translated_taxonomy($tax)) {
$translated_term = pll_get_term($t->term_id, $lang);
if ($translated_term) {
$new_terms[] = get_term_by('id', $translated_term, $tax)->slug;
$new_terms[] = get_term_by( 'id', $translated_term, $tax )->term_id;
} else {
//if no translation exists then create one
$result = static::createDefaultTermTranslation($tax, $t, $slug, $lang, false);
$result = static::createDefaultTermTranslation( $tax, $t, $slug, $lang, true );
if ($result) {
$new_terms[] = $result;
}
}
} else {
//otherwise not translatable, do synchronisation
$new_terms[] = $slug;
$new_terms[] = $t->term_id;
}
} //switch taxonomy slug
} // foreach old term
Expand Down

0 comments on commit 9933b27

Please sign in to comment.