Create a unstyled linked list of all tags used in a WordPress blog

Need a tag cloud without all the styles? Just a simple unstyled, linked list of all the tags used throughout a blog?

Try the wp_list_categories() function. Weird, I know. The taxonomy parameter of the function enables it to list post tags instead of categories.

The following displays a linked list of all the post tags sorted by popularity.

<ul>
    <?php wp_list_categories( array( 'taxonomy' => 'post_tag',
                                     'orderby' => 'count',
                                     'order' => 'DESC',
                                     'title_li' => '' ) ); ?>
</ul>

The empty title_li parameter is necessary to remove the default “Categories” title and it’s outer ul wrap.

Reference: wp list categories() is the WordPress Codex.

Leave a Reply

Your email address will not be published. Required fields are marked *