How to set the tag count on custom menu?

I’d like to set up Tag count on the custom menu.
For example, if I get the category count, the code on the fucntions.php is the following:

add_filter(‘wp_nav_menu_objects’,’my_nav_count’);
function my_nav_count($items){
foreach ($items as $item){
if($item->object == ‘category’){
$item->title .= ” (“. get_term($item->object_id,’category’)->count .”)”;
$args[] = $item;
}
}
return $args;
}

But, I don’t know how to put the tag count code on the functions.php.
I’d appreciate if anypne help me.

Thank you,

Yoos

Read more here:: How to set the tag count on custom menu?

Leave a Reply

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