You appear to be a bot. Output may be restricted
Description
Hide featured tag from displaying when global terms are queried from the front end.
Hooks into the "get_terms" filter.
Usage
$array = Featured_Content::hide_featured_term( $terms, $taxonomies, $args );
Parameters
- $terms
- ( array ) required – List of term objects. This is the return value of get_terms().
- $taxonomies
- ( array ) required – An array of taxonomy slugs.
- $args
- ( mixed ) required –
Returns
array A filtered array of terms.
Source
File name: twentyfourteen/inc/featured-content.php
Lines:
1 to 32 of 32
public static function hide_featured_term( $terms, $taxonomies, $args ) { // This filter is only appropriate on the front end. if ( is_admin() ) { return $terms; } // We only want to hide the featured tag. if ( ! in_array( 'post_tag', $taxonomies, true ) ) { return $terms; } // Bail if no terms were returned. if ( empty( $terms ) ) { 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 ) { unset( $terms[ $order ] ); } } return $terms; }