Make WordPress Core

Opened 9 years ago

Closed 6 years ago

#42762 closed enhancement (fixed)

rest_{$this->post_type}_query filter wrong place

Reported by: Krstarica Owned by: TimothyBlynJacobs
Priority: normal Milestone: 5.7
Component: REST API Version: 4.7
Severity: normal Keywords: has-patch early
Cc: Focuses:

Description

Taxonomies are added after rest_{$this->post_type}_query filter takes place, making impossible to alter the query completely.

It would be better to apply filter right before new WP_Query() in class-wp-rest-posts-controller.php:290.

Attachments (1)

42762.diff (2.8 KB ) - added by TimothyBlynJacobs 7 years ago.

Download all attachments as: .zip

Change History (8)

#1 @TimothyBlynJacobs
7 years ago

  • Keywords has-patch added
  • Milestone Awaiting ReviewFuture Release
  • Version 4.9.14.7

AFAICT, this was introduced like that in https://github.com/WP-API/WP-API/pull/2287

I think this can be fixed safely.

#2 @TimothyBlynJacobs
6 years ago

  • Keywords early added
  • Milestone Future Release5.7
  • Owner set to TimothyBlynJacobs
  • Status newassigned

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


6 years ago

#4 @metalandcoffee
6 years ago

  • Keywords needs-testing added

#5 @metalandcoffee
6 years ago

  • Keywords needs-refresh added; needs-testing removed

This ticket was mentioned in PR #849 on WordPress/wordpress-develop by TimothyBJacobs.


6 years ago
#6

  • Keywords needs-refresh removed

#7 @TimothyBlynJacobs
6 years ago

  • Resolutionfixed
  • Status assignedclosed

In 49923:

REST API: Move the WP_Query args filter after the tax_query is setup.

This ensures that the entire list of WP_Query args are filterable in the posts controller.

Props Krstarica, TimothyBlynJacobs.
Fixes #42762.

Note: See TracTickets for help on using tickets.