WordPress.org

Make WordPress Core

Ticket #41370: 41370.patch

File 41370.patch, 759 bytes (added by alibasheer, 4 years ago)
  • src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

     
    405405                        if ( $term_id = $term->get_error_data( 'term_exists' ) ) {
    406406                                $existing_term = get_term( $term_id, $this->taxonomy );
    407407                                $term->add_data( $existing_term->term_id, 'term_exists' );
     408
     409                                return new WP_Error( 'term_exists', __( 'A term with the name provided already exists in this taxonomy.' ), array( 'status' => 400, 'term_exists' => $term->get_error_data( 'term_exists' ) ) );
    408410                        }
    409411
    410412                        return $term;