#29192 closed defect (bug) (duplicate)
Twenty Fourteen: Featured_Content::hide_featured_term() triggers notice when using get_terms()
Reported by: | dnaber-de | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.9.1 |
Component: | Bundled Theme | Keywords: | |
Focuses: | Cc: |
Description
Featured_Content::hide_featured_term()
, which is a callback on the filter get_terms
assumes that the first parameter is always an array of stdClass
objects.
get_terms()
provides the possibility to fetch only term IDs and so the filter pass an array as numeric values to the callback, which then causes the following error:
Notice: Trying to get property of non-object in /var/www/wp-content/themes/twentyfourteen/inc/featured-content.php on line 334
In fact, every possible value of the fields
parameter besides all
and count
triggers this error.
The Following Plugin reproduces the Error, if at least one term of post_tag
taxonomy exists:
<?php /** * Plugin Name: Test */ add_filter( 'the_content', function( $content ) { $terms = get_terms( 'post_tag', array( 'hide_empty' => FALSE, 'fields' => 'ids' ) ); return $content; } );
Attachments (1)
Change History (4)
#3
@
10 years ago
- Keywords has-patch needs-unit-tests removed
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
- Summary changed from Twentyfourteen: Featured_Content::hide_featured_term() triggers notice when using get_terms() to Twenty Fourteen: Featured_Content::hide_featured_term() triggers notice when using get_terms()
Duplicate of #28072.
Note: See
TracTickets for help on using
tickets.
Obviously a duplicate of #28072