Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#42597 closed defect (bug) (fixed)

Term Already Exists Error No Longer Returns Term ID

Reported by: coleh Owned by: rachelbaker
Priority: normal Milestone: 4.9.3
Component: REST API Version: 4.9
Severity: normal Keywords: has-patch has-unit-tests fixed-major
Cc: Focuses:

Description

This ticket #41370 appears to have changed the error response for when a term already exists.

However, it used to return the term ID of the term inside the error data.

It no longer does that. The reason for needing this is if you are attempting to create a post on another site that has a category/tag that already exists, it will return the term ID so you can use that inside the post creation to properly set the taxonomy IDs of the newly created post.

Attachments (2)

42597.diff (1.8 KB ) - added by shooper 9 years ago.
Adds term_id of existing term to response. Includes unit tests.
42597.1.diff (1.8 KB ) - added by rachelbaker 9 years ago.
Updated patch to reduce overhead in the test_create_item_term_already_exists method

Download all attachments as: .zip

Change History (14)

#1 @swissspidy
9 years ago

#42600 was marked as a duplicate.

@shooper
9 years ago

Adds term_id of existing term to response. Includes unit tests.

#2 @shooper
9 years ago

  • Keywords has-patch has-unit-tests added

@swissspidy Good catch on the duplicate, didn't notice this ticket.

Patch added that adds term_id to the 'data' array in the response. This isn't 100% backward compatible with 4.8.3, but I don't think we can change the HTTP status code in the response without adding the 'status' key w/ add_data(). Open to suggestions.

This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.


9 years ago

@rachelbaker
9 years ago

Updated patch to reduce overhead in the test_create_item_term_already_exists method

#4 @rachelbaker
9 years ago

  • Owner set to rachelbaker
  • Resolutionfixed
  • Status newclosed

In 42350:

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

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

#5 @netweb
9 years ago

  • Milestone Awaiting Review5.0

#6 @coleh
9 years ago

Thanks for addressing this issue.

Any reason this is being slated for 5.0 which could be months away? This was a feature that worked previous to 4.9 and now doesn't work properly with 4.9 and could potentially break applications using the REST API as ours is broken. I am just trying to understand why this wouldn't have been included with 4.9.1 or a next minor release to fix a very small bug that broke functionality with the API response?

#7 @shooper
9 years ago

Agree with @coleh, this ticket addressed a regression. @netweb Could we target this fix for the next minor release?

#8 @netweb
9 years ago

  • Milestone 5.04.9.2
  • Resolution fixed
  • Status closedreopened

Makes sense @shooper and @shooper, moving to the 4.9.2 milestone and reopening for backporting

#9 @obenland
9 years ago

  • Keywords fixed-major added

#10 @dd32
9 years ago

  • Milestone 4.9.24.9.3

Bumping to 4.9.3 due to 4.9.2s release

This ticket was mentioned in Slack in #core by desrosj. View the logs.


9 years ago

#12 @jorbin
9 years ago

  • Resolutionfixed
  • Status reopenedclosed

In 42578:

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.

Note: See TracTickets for help on using tickets.