WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#54371 new enhancement

Add posts_results-like filters to WP_Query when return fields are ids or id=>parent

Reported by: sc0ttkclark Owned by:
Milestone: 6.0 Priority: normal
Severity: normal Version:
Component: Query Keywords: has-patch
Focuses: Cc:

Description

The WP_Query class offers no ability to hook into after queries that return posts as IDs or ID => Parent format.

The changes proposed here introduce new filters that offer similar capabilities to the pre-existing posts_results filter which runs in other cases.

This is similar to #41700 and #41678 but the approach is to address this by simply adding two new filters.

To review those other tickets and how they differ to this one:

  • #41700 requests hooking into after all of the logic runs but before the return is made.
  • #41678 requests refactoring the queries so that the individual ids / id=>parent queries can take advantage of all of the other hooks further down the line.
  • The suggestion in this ticket is to hook the same exact way that the existing posts_results filter does without refactoring or introducing new filter naming.

Change History (3)

This ticket was mentioned in PR #1805 on WordPress/wordpress-develop by sc0ttkclark.


2 months ago

  • Keywords has-patch added

This PR introduces two new filters that work exactly like posts_results but work for when fields is "ids" or "id=>parent".

Trac ticket: https://core.trac.wordpress.org/ticket/54371

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


2 months ago

#3 @davidbaumwald
2 months ago

  • Milestone changed from Awaiting Review to 6.0
Note: See TracTickets for help on using tickets.