| @@ 382-390 (lines=9) @@ | ||
| 379 | $term_info = wp_insert_term( $term, $taxonomy ); |
|
| 380 | } |
|
| 381 | ||
| 382 | if ( ! is_wp_error( $term_info ) ) { |
|
| 383 | if ( $is_hierarchical ) { |
|
| 384 | // Hierarchical terms must be added by ID |
|
| 385 | $tax_input[$taxonomy][] = (int) $term_info['term_id']; |
|
| 386 | } else { |
|
| 387 | // Non-hierarchical terms must be added by name |
|
| 388 | $tax_input[$taxonomy][] = $term; |
|
| 389 | } |
|
| 390 | } |
|
| 391 | } |
|
| 392 | } |
|
| 393 | ||
| @@ 412-420 (lines=9) @@ | ||
| 409 | $term = (int) $term; |
|
| 410 | $term_info = get_term_by( 'id', $term, $taxonomy, ARRAY_A ); |
|
| 411 | ||
| 412 | if ( $term_info && ! is_wp_error( $term_info ) ) { |
|
| 413 | if ( $is_hierarchical ) { |
|
| 414 | // Categories must be added by ID |
|
| 415 | $tax_input[$taxonomy][] = $term; |
|
| 416 | } else { |
|
| 417 | // Tags must be added by name |
|
| 418 | $tax_input[$taxonomy][] = $term_info['name']; |
|
| 419 | } |
|
| 420 | } |
|
| 421 | } |
|
| 422 | } |
|
| 423 | ||