WordPress : How to show tag count number of posts for Tag Cloud

Recently I modified the style of my tag cloud widget in a way, so it is less of a "cloud" and more of a list of tags with each tag in its own lines. With so much empty space on the right side of the tag, I wanted to add additional information to the visitors besides the name by showing the tag's count number of posts. I expected that the parameter for this behavior would already exist, but it turned out it doesn’t after looking at wp_tag_cloud function, which lists all parameters. Luckily, there is a filter available which we can use to make this work and is the topic of this article.

WordPress : How to modify parameters of default Tag Cloud Widget

Tag Cloud Widget gives visitors the ability to browse different topics based on tags on your site. Recently I wanted to customize it a little for this site and assumed the widget itself would give you these settings, but you can only edit the most basic parameters. Instead of widgets, we can display the tag using WordPress function wp_tag_cloud in the template, which supports more parameters. But what if we want to use the existing cloud tag widget? Luckily, there is a filter available that allows you to do that and is the topic of this article.