• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Featured_Content::hide_the_featured_term() – Hide featured tag from display when terms associated with a post object are queried from the front end.

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;
  }
 

 View on Trac

Published: 19th December 2019 | Last updated: 21st August 2020

Primary Sidebar

Information

Function name: Featured_Content::hide_the_featured_term
Class ref: Featured_Content
Plugin ref: Twenty Fourteen
Version: 3.0
Sourcefile: inc/featured-content.php
File ref: inc/featured-content.php
Deprecated?: No
API Letters: C,F,H,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 5.6.2. PHP: 7.3.27
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites