I needed to list all existing tags so I have some code that does it. Now I would like to put the count (the number of posts the tag is associated with) in front the tag like in the example given below.
first_tag - 18
second_tag - 24
third_tag - 48
I found a solution given here that displays count for one specific tag, but I need the counts for each and every tag. So, could this be modified to my need. Or do you have any other ideas. Will appreciate your help.
$taxonomy = "post_tag";
$term_slug = 'some-tag';
$term = get_term_by('slug', $term_slug, $taxonomy);
echo $term->count;
It is still not very clear what you are trying to do, but maybe
get_terms()
is what you want.