WordPress.org

Make WordPress Core

Opened 4 weeks ago

Last modified 13 days ago

#47591 reviewing enhancement

New filter to short circuit WP_Term_Query results

Reported by: tlovett1 Owned by: desrosj
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

In #44169 we added theusers_pre_query filter to allow plugins/themes to short circuit WP_User_Query results in order to provide their own.

This patch adds the terms_pre_query filter which is the same logic but for WP_Term_Query. Specifically 10up uses this to query results from Elasticsearch and bypass MySQL. This is very useful for performance on large sites.

Attachments (2)

terms-pre-query.diff (30.5 KB) - added by tlovett1 4 weeks ago.
terms-pre-query-tests.diff (1.0 KB) - added by tlovett1 4 weeks ago.
Unit test

Download all attachments as: .zip

Change History (5)

@tlovett1
4 weeks ago

Unit test

#1 @tlovett1
4 weeks ago

  • Keywords has-unit-tests added

#2 @desrosj
4 weeks ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to desrosj
  • Status changed from new to reviewing

Sounds good and looks ok on a quick glance. Assigning to review further.

#3 @JeffPaul
13 days ago

Looks like this may be a duplicate of #41246.

Note: See TracTickets for help on using tickets.