Opened 5 years ago
Closed 2 years ago
#53622 closed defect (bug) (wontfix)
Query Param status default is a string value, but an array is required
| Reported by: | austyfrosty | Owned by: | rachelbaker |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | REST API | Version: | |
| Severity: | minor | Keywords: | |
| Cc: | Focuses: | rest-api |
Description
The default value in the collection params that is a string. https://github.com/WordPress/wordpress-develop/blob/953e1c5f8313a89d4d3b99ab5996b4660045c976/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php#L2847
Really, we should make that ['publish'].
Original commit: https://github.com/WordPress/wordpress-develop/commit/ede099a7047a150a37d43a380e661b99387bce41
Change History (4)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thanks for the report, @austyfrosty!
Since r39104, the default for
statuswas changed from string to array to support querying multiple post statuses. However, string was/is still supported for backward compatibility.This suggested change, while making the
statusparam default consistent with the newer expected type, would introduce a backwards compatibility issue. Parts of this controller have been copied as-is in userland code, and for example could impact howsanitize_post_statuses()assumes the default is a string.I suggest
wontfixon this, though perhaps the code could be documented to indicate this inconsistency.Props @antonvlasenko and @azaozz for additional in-person discussion.