Add exception for specific tag

The get_the_tags() function returns an array of objects. So, you can step through the this array, and unset the object for the “Featured” tag, perhaps like so:

<?php
$tags = get_the_tags();

foreach ( $tags as $tag_key => $tag_object ) {
    if ( 'featured' == $tag_object->slug ) {
        unset( $tags[$tag_key] );
    }
}
// Continue with the rest of the code, here
?>

Note: untested. Also, assumes that the slug for the “Featured” tag is featured.

Leave a Comment