Make WordPress Core

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#28072 closed defect (bug) (fixed)

Twenty Fourteen: hide_featured_term always expects an array of term objects

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

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 changed from hide_featured_term always expects an array of term objects to Twenty Fourteen: hide_featured_term always expects an array of term objects
  • Version changed from trunk to 3.8

#2 @SergeyBiryukov
12 years ago

28072.patch fixes the PHP notice.

#3 @obenland
11 years ago

  • Keywords has-patch commit added
  • Milestone changed from Awaiting Review to 4.0

#4 @SergeyBiryukov
11 years ago

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

In 28536:

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

fixes #28072.

#5 @ocean90
11 years ago

#29192 was marked as a duplicate.

Note: See TracTickets for help on using tickets.