How to Limit number of tags in cloud widget for WordPress - 7-Views
How to Limit number of tags in cloud widget for WordPress
If your website has a lot of tags, and these tags are looking messy list inside the widget. So Instead of showing all tags, you can show a decent number of tags.
Here is the simple snippet will do a trick. Add this code to your theme functions.php file
//Show only 20 of tags inside widget function blog_7v_tag_widget_limit($args) { //Check if taxonomy option inside widget is set to tags if (isset($args['taxonomy']) & $args['taxonomy'] == 'post_tag') { $args['number'] = 20; } return $args; } //Register tag cloud filter callback add_filter('widget_tag_cloud_args', 'blog_7v_tag_widget_limit');