REST API: Add existing term_id to the error data object when attempting to create a duplicate term.

Merges [42350] into 4.9

Props shooper, coleh, rachelbaker.
Fixes #42597. See #41370.

Built from https://develop.svn.wordpress.org/branches/4.9@42578


git-svn-id: http://core.svn.wordpress.org/branches/4.9@42407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2018-01-23 20:22:39 +00:00
parent bbb8a324c7
commit 4aee92bb1c
2 changed files with 2 additions and 2 deletions

View File

@ -415,7 +415,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
if ( $term_id = $term->get_error_data( 'term_exists' ) ) {
$existing_term = get_term( $term_id, $this->taxonomy );
$term->add_data( $existing_term->term_id, 'term_exists' );
$term->add_data( array( 'status' => 409 ) );
$term->add_data( array( 'status' => 409, 'term_id' => $term_id ) );
}
return $term;

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9.3-alpha-42577';
$wp_version = '4.9.3-alpha-42578';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.