How to check if post has any tag?

Make better use of the parameters:

<?php 
the_tags(
    '<div class="tags"><span>Tags</span>', // before
    ' ', // separator
    '</div>' // after
); 
?>

Now you will never get any useless markup, because WordPress will not print anything when there are no tags for the current post.

Leave a Comment