Make WordPress Core

Opened 7 years ago

Last modified 18 months ago

#41678 new enhancement

Make sure all field returns use filters in WP Query

Reported by: spacedmonkey's profile spacedmonkey Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 1.5
Component: Query Keywords: has-patch needs-unit-tests dev-feedback
Focuses: Cc:

Description

Currently if fields is set to either id or id=>parent, it doesn't run through all the filters as these return early.

Attachments (1)

41678.diff (5.8 KB) - added by spacedmonkey 7 years ago.

Download all attachments as: .zip

Change History (4)

@spacedmonkey
7 years ago

#1 @spacedmonkey
7 years ago

  • Keywords has-patch needs-unit-tests dev-feedback added
  • Version set to 1.5

In 41678.diff code has be refactored to run through more filters.

Key features

  • There are now 2 only types of query, id and all fields. id=>parents are now treated the same as all fields and the return is changed at the latest possible moment.
  • New filter added named posts_results_ids for query of 'ids', to get a filter of result of query. Useful for caching plugins. This new filter is added, as posts_results expects an array of WP_Post objects.
  • 'id=>parents' now runs through the following filters the_posts, posts_results, posts_request_ids and split_the_query.

This patch will be extremely useful for a plugin like elasticpress.

#3 @spacedmonkey
18 months ago

  • Focuses performance removed
Note: See TracTickets for help on using tickets.