Hide category from sidebar

I’m using “Recently Viewed Posts” widget for my website showing what visitor recently visited post/page, by default the widget show all category post from the list, I need a way to hide a post category from from the widget.

Anyways here’s my code.

<?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”);
?>

I Took that from here: https://stackoverflow.com/questions/16408227/wordpress-exclude-a-category-from-appearing-in-menu-or-sidebar-widgets

Read more here:: Hide category from sidebar

Leave a Reply

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