wordpress logo banner

Putting limit on number of tags in  WordPress tag cloud widget is very important need of WordPress users, but the issue is that there is no option for this process in admin panel because its still new widget and not updated from long time, so we try to Google about it and it takes too much time for getting right solution, its very time consuming and hard for getting right solution, just Google about it and try different keywords for search and just Test Test Test and also getting frustrated doing this process.

So after thinking about this topic seriously, we have write this solution here for making your work easy and saving your time.

We hope this will help you, this technique is tested on our blog honsla.com

 

How to limit number of tags in WordPress tag cloud widget

1 . Find the file in yourdomain.com/wp-includes/category-template.php

2 . Download it to your computer then open it with Notepad for editing

3 . Find this code around line 525:

function wp_tag_cloud( $args = ” ) {
$defaults = array(
‘smallest’ => 8, ‘largest’ => 12, ‘unit’ => ‘pt’, ‘number’ => 45,

( Change the 45 number with number of tags you want and 8 is for smallest word size and 12 is for largest word size of tag cloud widget )

As for this post, i am using the latest version of WordPress 3.8

Note: Before editing that file, please take backup of it, then upload back the edited file to server.

Now check your WordPress site you will get your result, that’s all!

 

If above process not worked for you, then try this also:

1 . Find the file in yourdomain.com/wp-content/themes/your-theme-name/functions.php

2 . Download it to your computer then open it with Notepad for editing

3 . Add the following code to it:

//Register tag cloud filter callback
add_filter('widget_tag_cloud_args', 'tag_widget_limit');

//Limit number of tags inside widget
function tag_widget_limit($args){

 //Check if taxonomy option inside widget is set to tags
 if(isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag'){
  $args['number'] = 10; //Limit number of tags
 }

 return $args;
}

Note: Before editing that file, please take backup of it, then upload back the edited file to server.

Now check your WordPress site you will get your result, that’s all!

 

Unfortunately, It will appears back again, so you have to fix this every time you update your WordPress site, till anyone will make better way to do this.

 

Thanks for reading my post related to Put Limit on number of tags in WordPress Tag Cloud Widget

Please post your comments and suggestions about this post that how much you like it

Thanks for reading my post related to SEO

Please post your comments and suggestions about this post that how much you like it

– See more at: http://honsla1.com/rookies-know-seo.html#sthash.JYuaWq58.dpuf

Thanks for reading my post related to SEO

Please post your comments and suggestions about this post that how much you like it

– See more at: http://honsla1.com/rookies-know-seo.html#sthash.JYuaWq58.dpuf

By Harsh Sharma

Hey friends i am Harsh Sharma from India, I made INDPAL to give you tons of quality information so keep reading and get in touch with us.

Leave a Reply