You appear to be a bot. Output may be restricted
Description
Hide featured tag from display when terms associated with a post object are queried from the front end.
Hooks into the "get_the_terms" filter.
Usage
$array = Featured_Content::hide_the_featured_term( $terms, $id, $taxonomy );
Parameters
- $terms
- ( array ) required – A list of term objects. This is the return value of get_the_terms().
- $id
- ( int ) required – The ID field for the post object that terms are associated with.
- $taxonomy
- ( array ) required – An array of taxonomy slugs.
Returns
array Filtered array of terms.
Source
File name: twentyfourteen/inc/featured-content.php
Lines:
1 to 27 of 27
public static function hide_the_featured_term( $terms, $id, $taxonomy ) { // This filter is only appropriate on the front end. if ( is_admin() ) { return $terms; } // Make sure we are in the correct taxonomy. if ( 'post_tag' !== $taxonomy ) { return $terms; } // No terms? Return early! if ( empty( $terms ) ) { 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[ $term->term_id ] ); } } return $terms; }