Archived topic
show tags
3 replies · Started by Den on January 21, 2022
Viewing posts 1–4 of 4
Hello Team,
Hope you guys are doing well.
I really wanna know how do I hide specific Tags using their id.
HERE Tom gave a PHP code to limit the visibility of tags.
Which works absolutely fine. But i'll be very happy if you help me out with this "hide specific Tags using their id"
Tom's code:
add_filter( 'widget_tag_cloud_args', 'generate_tag_cloud_limit' );
function generate_tag_cloud_limit($args){
// Check if taxonomy option of the widget is set to tags
if ( isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag' ){
$args['number'] = 100; // Number of tags to show
}
return $args;
}
Hi there,
try this:
add_filter( 'widget_tag_cloud_args', 'jmw_exclude_tag_from_tag_cloud');
function jmw_exclude_tag_from_tag_cloud( $args ) {
$args[ 'exclude' ] = '36'; // ID of the tag. If multiple tags use comma delimited sting '2,5,36'
return $args;
}
For reference - this is the source of that code:
Amazing... Thanks
You're welcome
This archived topic is closed to new replies.