From 7de1eac464bbf1c867eda0e44589f79c859cd222 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 22 May 2014 09:25:15 +0000 Subject: [PATCH] Twenty Fourteen: Bail early from Featured_Content::hide_featured_term() if term objects are unavailable. fixes #28072. Built from https://develop.svn.wordpress.org/trunk@28536 git-svn-id: http://core.svn.wordpress.org/trunk@28362 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../themes/twentyfourteen/inc/featured-content.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-content/themes/twentyfourteen/inc/featured-content.php b/wp-content/themes/twentyfourteen/inc/featured-content.php index 3f9dc411a4..f9789d8dec 100644 --- a/wp-content/themes/twentyfourteen/inc/featured-content.php +++ b/wp-content/themes/twentyfourteen/inc/featured-content.php @@ -106,7 +106,7 @@ class Featured_Content { */ public static function wp_loaded() { if ( self::get_setting( 'hide-tag' ) ) { - add_filter( 'get_terms', array( __CLASS__, 'hide_featured_term' ), 10, 2 ); + add_filter( 'get_terms', array( __CLASS__, 'hide_featured_term' ), 10, 3 ); add_filter( 'get_the_terms', array( __CLASS__, 'hide_the_featured_term' ), 10, 3 ); } } @@ -312,7 +312,7 @@ class Featured_Content { * * @uses Featured_Content::get_setting() */ - public static function hide_featured_term( $terms, $taxonomies ) { + public static function hide_featured_term( $terms, $taxonomies, $args ) { // This filter is only appropriate on the front-end. if ( is_admin() ) { @@ -329,6 +329,11 @@ class Featured_Content { return $terms; } + // Bail if term objects are unavailable. + if ( 'all' != $args['fields'] ) { + return $terms; + } + $settings = self::get_setting(); foreach( $terms as $order => $term ) { if ( ( $settings['tag-id'] === $term->term_id || $settings['tag-name'] === $term->name ) && 'post_tag' === $term->taxonomy ) {