High-quality Professional Digital Services

Show fewer tags in WordPress

Load WordPress Sites in as fast as 37ms!

Your WordPress website probably just started growing and it has a lot of tags. Some website designs might start looking out of sync with that big, messy list inside the WordPress tag cloud widget. If you would rather still show a number of tags instead of removing them, here’s how:

//Adds a filter callback
add_filter('widget_tag_cloud_args', 'tag_widget_limit');
//This will limit the number of tags
function tag_widget_limit($args){
 //Checks if taxonomy option inside widget is set to tags
 if(isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag'){
  $args['number'] = 20; //The number of tags displayed now
 return $args;

Just go inside your theme’s folder and paste the code at the end of your functions.php file.

You might also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More