From 4aee92bb1c9035e979101c2e3603f4a958b37748 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Tue, 23 Jan 2018 20:22:39 +0000 Subject: [PATCH] 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 --- .../rest-api/endpoints/class-wp-rest-terms-controller.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php index 749a6d6870..477df8ba48 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php @@ -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; diff --git a/wp-includes/version.php b/wp-includes/version.php index 8886867bda..be1bcba2d2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.