Forums » Fixing WordPress » tag cloud filter limit error

  • Resolved mohdaljaraba

    (@mohdaljaraba)


    Hello, im trying to limit tags number in widgets but i get error with red https://prnt.sc/shq24e
    this code im using :

    //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;
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘tag cloud filter limit error’ is closed to new replies.