[wp-trac] [WordPress Trac] #42600: Adding term with duplicate name via REST API no longer returning existing term ID
WordPress Trac
noreply at wordpress.org
Fri Nov 17 13:46:19 UTC 2017
#42600: Adding term with duplicate name via REST API no longer returning existing
term ID
--------------------------+-----------------------------
Reporter: shooper | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 4.9
Severity: normal | Keywords:
Focuses: rest-api |
--------------------------+-----------------------------
Reported by @coleh in the ticket that caused this change, #41370.
In WordPress 4.9, if you add a term with a duplicate name using the REST
API, the 'data' element used to contain the ID of the existing term. It
now just an array that only includes the HTTP status code.
Here's the output of the REST API calls in both 4.8 and 4.9:
In WordPress 4.8, returns HTTP status code 500 and this body:
{{{
{
"code": "term_exists",
"message": "A term with the name provided already exists with this
parent.",
"data": 2
}
}}}
In WordPress 4.9, returns HTTP status code 409 and this body:
{{{
{
"code": "term_exists",
"message": "A term with the name provided already exists with this
parent.",
"data": {
"status": 409
}
}
}}}
Note that this was my original patch. I'm happy to provide the fix for it
here.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42600>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list