Fixes bug when adding a existing term in bulk

This commit is contained in:
weryques 2019-01-31 11:36:27 -02:00
parent 362b43cf5c
commit 2b32d2ab51
1 changed files with 18 additions and 8 deletions

View File

@ -292,14 +292,24 @@ class Terms extends Repository {
} elseif ( $taxonomy instanceof Entities\Taxonomy ) { } elseif ( $taxonomy instanceof Entities\Taxonomy ) {
$taxonomy_slug = $taxonomy->get_db_identifier(); $taxonomy_slug = $taxonomy->get_db_identifier();
} }
$args = [ if(is_numeric($name)){
'name' => $name, $args = [
'taxonomy' => $taxonomy_slug, 'id' => (int) $name,
'parent' => $parent, 'taxonomy' => $taxonomy_slug,
'hide_empty' => 0, 'parent' => $parent,
'suppress_filter' => true 'hide_empty' => 0,
]; 'suppress_filter' => true
];
} else {
$args = [
'name' => $name,
'taxonomy' => $taxonomy_slug,
'parent' => $parent,
'hide_empty' => 0,
'suppress_filter' => true
];
}
if (is_null($parent)) { if (is_null($parent)) {
unset($args['parent']); unset($args['parent']);