Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#15410 closed defect (bug) (fixed)

filter for get_the_terms

Reported by: filosofo Owned by: filosofo
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: Taxonomy Keywords: has-patch
Focuses: Cc:


get_the_terms() really needs a filter, because it pulls data when available directly from the cache.

That means that to reliably filter the terms based on the context in which they're being used, you have to filter it downstream in the functions that are calling it, which doesn't always work well.

For example, get_the_term_list() calls get_the_terms(), but the filter for get_the_term_list() comes too late to prevent a return value; filtering out the terms there will still return the before and after strings.

Attachments (1)

filter_get_the_terms.15410.diff (433 bytes) - added by filosofo 5 years ago.

Download all attachments as: .zip

Change History (2)

#1 @scribu
5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [16342]) Add 'get_the_terms' filter. Props filosofo. Fixes #15410

Note: See TracTickets for help on using tickets.