How do I get all the post tags in WordPress?
Use get_tags to get all posts tags
<?php
$tags = get_tags(array(
'hide_empty' => false
));
echo '<ul>';
foreach ($tags as $tag) {
echo '<li>' . $tag->name . '</li>';
}
echo '</ul>';
?>
Try This
$tags = get_tags();
$html = '<div class="post_tags">';
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
$html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
$html .= "{$tag->name}</a>";
}
$html .= '</div>';
echo $html;