Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#47591 closed enhancement (duplicate)

New filter to short circuit WP_Term_Query results

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


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 5 years ago.
terms-pre-query-tests.diff (1.0 KB) - added by tlovett1 5 years ago.
Unit test

Download all attachments as: .zip

Change History (6)

5 years ago

Unit test

#1 @tlovett1
5 years ago

  • Keywords has-unit-tests added

#2 @desrosj
5 years 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
5 years ago

Looks like this may be a duplicate of #41246.

#4 @desrosj
5 years 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.