Make WordPress Core

Opened 7 years ago

Closed 4 years ago

#42762 closed enhancement (fixed)

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

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


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 5 years ago.

Download all attachments as: .zip

Change History (8)

#1 @TimothyBlynJacobs
5 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 4.9.1 to 4.7

AFAICT, this was introduced like that in

I think this can be fixed safely.

#2 @TimothyBlynJacobs
4 years ago

  • Keywords early added
  • Milestone changed from Future Release to 5.7
  • Owner set to TimothyBlynJacobs
  • Status changed from new to assigned

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

4 years ago

#4 @metalandcoffee
4 years ago

  • Keywords needs-testing added

#5 @metalandcoffee
4 years ago

  • Keywords needs-refresh added; needs-testing removed

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

4 years ago

  • Keywords needs-refresh removed

#7 @TimothyBlynJacobs
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

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.