#38580 closed defect (bug) (duplicate)
REST API: Fix querying multiple post statuses at once
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.7 |
| Component: | REST API | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
Description
Currently the description of the status parameter on the post listing endpoint is as follows:
Limit result set to posts assigned a specific status; can be comma-delimited list of status types.
Passing a comma-delimited list of status types is broken in trunk due to the additional validation introduced in [38911]. This patch fixes the issue and adds a couple of tests.
This patch also allows an array of post statuses to be passed, to make status more consistent with other similar arguments.
Questions:
- I've set
statusto anarraytype in the schema. Does this make sense given that there is anenumvalue present in the schema also? - I don't think we need to validate the
publishstatus like what was done in https://github.com/danielbachhuber/wordpress-develop/pull/4/commits/51de903 since it is always whitelisted. Can someone confirm? - Right now there is both a
validate_callbackand asanitize_callback, which means we need to callwp_parse_slug_listtwice. Should we move all of this logic intosanitize_callbackinstead?
Attachments (2)
Change History (8)
This ticket was mentioned in Slack in #core-restapi by jnylen. View the logs.
9 years ago
#3
@
9 years ago
See also #38420, where @websupporter & I were working on the same issue -- the approach here works around some of the issues in our original patch.
Move all validation into sanitize_callback per Slack discussion.