Skip to content

Instantly share code, notes, and snippets.

@kreamweb
Created December 27, 2014 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kreamweb/3713a65fc997d9322431 to your computer and use it in GitHub Desktop.
Save kreamweb/3713a65fc997d9322431 to your computer and use it in GitHub Desktop.
[Wordpress] Limit the Number of tags in a widget
<?php
//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'] = 20; //Limit number of tags
}
return $args;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment