From 0e656c1a102843597b7728231e560644f2e05c49 Mon Sep 17 00:00:00 2001 From: Rachel Baker Date: Sun, 3 Dec 2017 19:09:49 +0000 Subject: [PATCH] REST API: Correct HTTP status code in error for requests to create a duplicate term. The 409 error code is intended for situations where it is expected that the user will resolve the conflict and resubmit the same request. We use 400 error codes for other routes when a duplicate request is made. The 400 status code tells the user they need to modify their request for it to be successful. Props shooper. Fixes #42781. See #41370. Built from https://develop.svn.wordpress.org/trunk@42354 git-svn-id: http://core.svn.wordpress.org/trunk@42183 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 7c62c34fe8..5a844bdfce 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 @@ -419,7 +419,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_id' => $term_id ) ); + $term->add_data( array( 'status' => 400, 'term_id' => $term_id ) ); } return $term; diff --git a/wp-includes/version.php b/wp-includes/version.php index fc271a953d..463f8658c4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-42353'; +$wp_version = '5.0-alpha-42354'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.