WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 4 weeks ago

#47591 closed enhancement (duplicate)

New filter to short circuit WP_Term_Query results

Reported by: tlovett1 Owned by: desrosj
Milestone: 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 3 months ago.
terms-pre-query-tests.diff (1.0 KB) - added by tlovett1 3 months ago.
Unit test

Download all attachments as: .zip

Change History (6)

@tlovett1
3 months ago

Unit test

#1 @tlovett1
3 months ago

  • Keywords has-unit-tests added

#2 @desrosj
3 months 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
3 months ago

Looks like this may be a duplicate of #41246.

#4 @desrosj
4 weeks ago

  • Milestone 5.3 deleted
  • Resolution set to duplicate
  • Status changed from reviewing to closed

Duplicate of #41246.

Thanks @JeffPaul. Confirmed that this is a duplicate. The terms_pre_query was added in [45584].

Note: See TracTickets for help on using tickets.