Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#34728 closed defect (bug) (invalid)

Registering API argument that conflicts with public_query_var can cause warnings

Reported by: joehoyle Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: REST API Keywords:
Focuses: Cc:


Originally reported in https://github.com/WP-API/WP-API/issues/982

Weird things happen if you happen to use a public_query_var GET param in your endpoint. For example, I have a taxonomy called series which has the public_query_var of series - however I also have an endpoint that has a GET param of series which is an array. This leads to Weirdness and Warnings (TM).


parse_request in my case was still too late for some warnings as parse_request is called after the vars have been set on the $wp object (which expects types to match the public_query_var type (which is always scalar)

Change History (4)

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

5 years ago

#2 @danielbachhuber
5 years ago

  • Reporter changed from danielbachhuber to joehoyle

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

4 years ago

#4 @joehoyle
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This is no longer an issue, as we hook the rest api in pre-main query now, so the public_query_var that WP_Query looks for are no longer run.

Note: See TracTickets for help on using tickets.