Ticket #41035: 41035.1.patch
File 41035.1.patch, 1.2 KB (added by , 6 years ago) |
---|
-
src/wp-includes/taxonomy.php
2391 2391 $term_ids = array(); 2392 2392 $new_tt_ids = array(); 2393 2393 2394 $terms_error = new WP_Error(); 2395 2394 2396 foreach ( (array) $terms as $term ) { 2395 2397 if ( ! strlen( trim( $term ) ) ) { 2396 2398 continue; … … 2403 2405 } 2404 2406 $term_info = wp_insert_term( $term, $taxonomy ); 2405 2407 } 2408 2406 2409 if ( is_wp_error( $term_info ) ) { 2407 return $term_info; 2410 $terms_error->add( 2411 $term_info->get_error_code(), 2412 $term . ': ' . $term_info->get_error_message() 2413 ); 2414 continue; 2408 2415 } 2416 2409 2417 $term_ids[] = $term_info['term_id']; 2410 2418 $tt_id = $term_info['term_taxonomy_id']; 2411 2419 $tt_ids[] = $tt_id; … … 2505 2513 * @param array $old_tt_ids Old array of term taxonomy IDs. 2506 2514 */ 2507 2515 do_action( 'set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids ); 2508 return $tt_ids; 2516 2517 if ( ! $terms_error->has_errors() ) { 2518 return $tt_ids; 2519 } elseif ( ! empty( $tt_ids ) ) { 2520 $terms_error->add_data( $tt_ids, 'affected_terms_tt_ids' ); 2521 } 2522 2523 return $terms_error; 2524 2509 2525 } 2510 2526 2511 2527 /**