How to display tags with post_content

I have this code to display the content of a specific post outside the loop (actually in the archive.php template file). How do I include the tags?

?php
$my_id = 1576;
$post_id_1576= get_post($my_id);
$content = $post_id_1576-post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]', ']]', $content);
echo $content;
?

Topic post-content tags Wordpress

Category Web


Simply use get_the_tags($my_id), example :

$posttags = get_the_tags($my_id);
if ($posttags) {
  foreach($posttags as $tag) {
    echo $tag->name . ' '; 
  }
}

Refering to WordPress codex

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.