WordPress Example | Get All Tags of a Post

This wordpress code example lists all tags of a post.

$post_tags = get_the_tags();
if ( ! empty( $post_tags ) ) {
    echo '<ul>';
    foreach( $post_tags as $post_tag ) {
        echo '<li><a href="' . get_tag_link( $post_tag ) . '">' . $post_tag->name . '</a></li>';
    }
    echo '</ul>';
}