/** * Hide "featured" tag from the front-end. * * Has to run on wp_loaded so that the preview filters of the customizer * have a chance to alter the value. */ public static function wp_loaded() { if (self::get_setting('hide-tag')) { $settings = self::get_setting(); // This is done before setting filters for get_terms in order to avoid an infinite filter loop self::$tag = get_term_by('name', $settings['tag-name'], 'post_tag'); add_filter('get_terms', array(__CLASS__, 'hide_featured_term'), 10, 3); add_filter('get_the_terms', array(__CLASS__, 'hide_the_featured_term'), 10, 3); } }