WordPress.org

Ready to get started?Download WordPress

Forums

Excluding Category From Widget (4 posts)

  1. Foosho
    Member
    Posted 2 years ago #

    Hi all,

    I try to exclude a category from my "categories widget". Where and how can I do this? Can't find a file that controles the category list and where I can exclude a catt.

    Thnx

  2. Spike
    Member
    Posted 2 years ago #

    http://wordpress.org/support/topic/exclude-specific-categories-from-sidebar-categories-widget?replies=5

    Found this link searching your post title in google. Give the plugin mentioned there a shot.

  3. Foosho
    Member
    Posted 2 years ago #

    thnx for the quick reply. I also found several plugins, but I prefer code. After searching for a while, I found the following code, which should be placed in MYTHEME/functions.php.

    <?php
    function exclude_widget_categories($args){
    $exclude = "3,6,18"; // The IDs of the excluding categories
    $args["exclude"] = $exclude;
    return $args;
    }
    add_filter("widget_categories_args","exclude_widget_categories");
    ?>

  4. seanbelly
    Member
    Posted 2 years ago #

    Nice solution Foosho!

Topic Closed

This topic has been closed to new replies.

About this Topic