Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#28072 closed defect (bug) (fixed)

Twenty Fourteen: hide_featured_term always expects an array of term objects

Reported by: jadpm Owned by: SergeyBiryukov
Priority: normal Milestone: 4.0
Component: Bundled Theme Version: 3.8
Severity: normal Keywords: has-patch commit
Cc: Focuses:

Description

twentyfourteen/inc/featured-content.php contains a filter on the 'get_terms' hook: hide_featured_term (line 315) that is always expecting an array of term objects to be passed. This filter is used to "hide featured tag from displaying when global terms are queried from the front-end" as its inline documentation states.

However, get_terms() can use a 'fields' argument that will make that filter be feeded with an array of IDs, names or even a simple term count, among other options. When using get_terms() in the frontend to get anything but term objects, this filter hide_featured_term produces a PHP notice.

The main problem to solve here is that when querying for anything different from term objects using multiple taxonomies, there is no way of knowing the actual taxonomy each term belongs to, so we might not be able to separate post_tag terms from terms in other taxonomy. This could make unsetting featured tags from the list of returned terms impossible (or at least quite expensive), unless term IDs and term names are both unique (which I think is not the case).

Attachments (1)

28072.patch​ (1.3 KB ) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (6)

#1 @obenland
12 years ago

  • Summary hide_featured_term always expects an array of term objects → Twenty Fourteen: hide_featured_term always expects an array of term objects
  • Version trunk → 3.8

#2 @SergeyBiryukov
12 years ago

28072.patch​ fixes the PHP notice.

#3 @obenland
12 years ago

  • Keywords has-patch commit added
  • Milestone Awaiting Review → 4.0

#4 @SergeyBiryukov
12 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 28536:

Twenty Fourteen: Bail early from Featured_Content::hide_featured_term() if term objects are unavailable.

fixes #28072.

#5 @ocean90
12 years ago

#29192 was marked as a duplicate.

Note: See TracTickets for help on using tickets.