I want to if the check next post has a specific tag. I tried the following code, but it is not working because has_tag() only works in the loop. I want to use it outside the loop.
<?php if ( has_tag( 'mario', $post->ID ) ) : ?>
my content
<?php endif; ?>
The following code lists the tags from post, but I don't know how to make it work with an if() / else() condition:
global $post;
foreach ( get_the_tags( $post->ID ) as $tag ) {
echo $tag->name . ', ';
}
