This is a general concept question, how does wordpress calculate the popular tags? I have tried to experiment with get_tags
$tags = get_tags(array(
'order' => 'DESC',
'orderby' => 'count',
'number' => 10,
'pad_counts' => true,
'hide_empty' => true
));
foreach ($tags as $tag) {
echo '$tag->count';
}
I tried to repeated visit a page with certain tag, but it doesn't tell me how popular the tag is. How would I know if a tag is popular or not? I would like to find out which variable or parameter is responsible for the tag popularity. Thanks much!
Use wp_tag_cloud
and orderby
=> count
so it will return most popular tag first then other popular as so on.
It will show tags by its usage in posts by count.
$tags = wp_tag_cloud(array(
'echo' => false,
'orderby' => 'count',
'order' => 'DESC'
));
foreach ($tags as $tag) {
echo '$tag->count';
}