Opened 10 years ago
Closed 9 years ago
#34728 closed defect (bug) (invalid)
Registering API argument that conflicts with public_query_var can cause warnings
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | REST API | Keywords: | |
| Focuses: | Cc: |
Description
Originally reported in https://github.com/WP-API/WP-API/issues/982
Weird things happen if you happen to use a
public_query_varGET param in your endpoint. For example, I have a taxonomy calledserieswhich has thepublic_query_varofseries- however I also have an endpoint that has a GET param ofserieswhich is an array. This leads to Weirdness and Warnings (TM).
[...]
parse_requestin my case was still too late for some warnings asparse_requestis called after the vars have been set on the$wpobject (which expects types to match the public_query_var type (which is always scalar)
This is no longer an issue, as we hook the rest api in pre-main query now, so the
public_query_varthat WP_Query looks for are no longer run.