• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
Callia Web

Callia Web

Websites - Design with Purpose

  • Home
  • Websites
  • Support
  • Our Work
  • About
  • Contact

Exclude tag from the WordPress tag cloud widget

27 Jul 2016

Ever wanted to exclude a tag from the tag cloud but there’s no option in the widget? Well in wp-includes/widgets/class-wp-widget-tag-cloud.php there is a filter called widget_tag_cloud_args you can use.

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;
}

/* 
* Other arguments that can be changed
* 'smallest'                  => 8, 
* 'largest'                   => 22,
* 'unit'                      => 'pt', 
* 'number'                    => 45,  
* 'format'                    => 'flat',
* 'separator'                 => "\n",
* 'orderby'                   => 'name', 
* 'order'                     => 'ASC',
* 'exclude'                   => null, 
* 'include'                   => null, 
* 'topic_count_text_callback' => default_topic_count_text,
* 'link'                      => 'view', 
* 'taxonomy'                  => 'post_tag', 
* 'echo'                      => true,
*/

See the wp_tag_cloud codex page for more details on the other things you can change, for example, have a cloud of custom taxonomies or change the font sizes of the smallest and largest tags.

You would put your code in your theme’s functions.php

Share this post:

Share on FacebookShare on LinkedInShare on E-mailShare on WhatsApp

About Jo Waltham

Jo Waltham is the founder of Callia Web and is passionate about helping people with their websites.

Liked this post? Subscribe to get our next post direct to your inbox.


Previous Post:bad accessibilityAccessibility basics for my WordPress website: what is it and why is it important?
Next Post:Building a minimum viable website: benefits of starting with the essentialsminimum viable website

Reader Interactions

Comments

  1. Sebastian

    16 Jun 2017 at 12:08 pm

    Hi, this is exactly what I was looking for, only with taxonomy set to “Categories” instead of “Tags”. Any idea how to set-up the filter to exclude specific categories from the “tag”/category cloud?

    Reply
    • Jo Waltham

      19 Jun 2017 at 8:42 pm

      Untested, but I think you just need to supply the ID of the category you wish to exclude to the above code. Try it and let me know if it works.

      Reply
      • Sebastian

        21 Jun 2017 at 10:02 am

        Thank you so much!!! It works like a charm!! ๐Ÿ™‚

        Reply
  2. Michael

    25 Mar 2018 at 12:37 pm

    Users who don’t feel comfortable writing their own code could also install the Tag Groups plugin http://wordpress.org/extend/plugins/tag-groups/ and leave all tags they don’t want to display unassigned. ๐Ÿ™‚

    Reply
  3. John

    22 May 2019 at 7:32 pm

    Won’t this just get overwritten each time you update wordpress though?

    Reply
    • Jo Waltham

      2 Jul 2019 at 3:41 pm

      Hi John. Aha! I didn’t make that clear in the post and I’ve edited it to say that you use the filter to add your function and you put both in your functions.php (unless you want to create your own plugin for it).

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Ready to get started?

Get in touch

Ask Callia Web’s AI

Contact us

Telephone: 01672 666001

Email: hello@calliaweb.co.uk

Quick links

Websites

Our work

Testimonials

About

Blog

Popular posts

Using headings in WordPress

Accessibility basics

Image sizes and aspect ratios

Making images equal size

Beginner’s guide to Analytics

Legal

Privacy policy / Cookie policy

Terms of service

Company number: 08316519

Registered address: Bowman House, Royal Wootton Bassett, Wiltshire, SN4 7DB

Copyright © 2025 ยท Callia Web Ltd ยท All Rights Reserved