WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 9 months ago

#42762 closed enhancement (fixed)

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

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

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

Download all attachments as: .zip

Change History (8)

#1 @TimothyBlynJacobs
2 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 https://github.com/WP-API/WP-API/pull/2287

I think this can be fixed safely.

#2 @TimothyBlynJacobs
11 months 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.


9 months ago

#4 @metalandcoffee
9 months ago

  • Keywords needs-testing added

#5 @metalandcoffee
9 months ago

  • Keywords needs-refresh added; needs-testing removed

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


9 months ago

  • Keywords needs-refresh removed

#7 @TimothyBlynJacobs
9 months 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.