Editing the core WordPress files (like class-wp-widget-categories.php
) directly is a no-go. When WordPress updates, it’ll overwrite any changes you made to the core files. Plus, it’s generally frowned upon in the developer community—it’s just not a good habit to get into.
If the widget you’re using is the core’s default category widget, try adding the following code to your theme’s functions.php file:
function exclude_categories($args){
$exclude = get_cat_ID('Blog'); // Get the ID of the category you want to exclude
$args["exclude"] = $exclude; // Exclude the category
return $args;
}
add_filter("widget_categories_args","exclude_categories");
After adding this, the “Blog” category should disappear from the sidebar. If it’s still playing coy, clear your cache, then take another look.
Related Posts:
- HowTo: Add Class to Sidebar Widget List-Items
- Add class to before_widget for all widgets with a dropdown and a counter
- Registering Sidebars and Sidebar Widgets. Sidebar Widgets Not Displaying
- How do I display the “Archives” widget layout (sidebar) in WordPress by ‘year’ then by ‘months’?
- searchform.php override not working
- Displaying details of a post in a sidebar
- How can I hard code my sidebar?
- Allow different tags in widget titles
- Display problems in admin dashboard when creating a new theme from scratch
- Best strategy for providing theme options using customizer
- Creating a Playlist of Widgets
- How to display only some widgets of a sidebar?
- Replacing static code in a template file with a sidebar and widgets?
- How to store widget fields data as an array?
- What is the difference between wp_register_sidebar_widget and register_widget?
- How to enqueue script if widget is displayed on page?
- Call dynamic_sidebar but include/exclude named widgets?
- How to wrap the widget content with a div or get the widget title outside?
- register_sidebar ignores ‘id’ and ‘class’
- How wp_cache is supposed to work, and does it help with performance?
- How to determine the current widget’s parent container (sidebar widget id)
- Adding widgets programatically: how to avoid collisions?
- How to get the name and description of a sidebar in theme?
- Enabling Widgets By Default in Custom Theme Development
- use add_action(‘wp_head’) in a widget for generating dynamic CSS styles
- File included into functions.php via require_once() won’t echo?
- Adding inline styles from a widget
- modify a output of a widget
- Context aware widgets. My work in progress
- How to determine which sidebar the widget has been added to, via widget admin?
- How to Modify a Widgets UL and/or LI Classes
- Should use widgets in this case?
- Enabling Default Widgets in a Custom Theme
- How the WordPress sidebar works
- how to create theme based widget that can be drop in sider bar or footer
- Can not Remove Archives and Meta from Sidebar
- How to allow admins to create a sidebar from the admin
- Adding WordPress colorpicker in widget settings
- How to add multiple custom widget areas
- Best practices: Custom theme sidebar menu – hardcode or widget?
- Is it a good idea to make whole theme widgetized?
- Add tinymce to widget textareas
- Widgets with groups / sub widgets? Widget in a widget?
- How i can get widgets areas working in customizer?
- how can I remove the sidebar from my wp homepage [closed]
- Toggle Sidebar Display
- Widget items disappearing
- How can i initialize a widgetized sidebar (with widgets)
- How do you force a sidebar widget to have a container div around all child widgets?
- Add widgets to available widgets section without changing the theme?
- Custom Widget options in theme
- Can I have a widget and sidebars in custom theme?
- Can’t work out why widget contents disappear from admin
- Disable dashboard drag&drop
- Save Widget State Between Theme Swaps?
- “Add A Widget” button in the Customizer
- $this->get_field_id() not working in customizer
- How do i place same widgets multiple time by default on theme activation?
- “Theme without sidebar.php is deprecated”
- Widget Option is Missing
- How to use widget in a widget-less WordPress theme?
- Load sidebar template just once to prevent multiple animations
- Is it acceptable for a WordPress theme to not accept widgets?
- Register sidebar ‘before’ and ‘after’ html as div rather than li tags
- How is the `get_sidebar` function meant to be used to call a 2nd sidebar?
- How can I specify that an area of my theme contains widgets?
- How to include a file only on dashboard widgets page?
- Should I create multiple sidebars, or use or one dynamic sidebar with logic to determine it’s abilities?
- Load different single.php templates according to post layout selection
- A post with a clear:both in its css destroy the theme design, and the sidebar is moved to the bottom
- How to add sidebar to Isola theme? [closed]
- Change the sidebar from left to right twentyfourteen theme
- Changing sidebar.php and footer.php depending on URL
- How to hide custom sidebar on mobile
- Unable to add widgets to sidebars in custom theme
- Recommended sidebar / content widths
- How to exclude categories from a sidebar with active widgets in it?
- Hide/disable sidebar using shortcode?
- How to setup sidebar modules to use jQuery Accordian
- Available widgets is not showing up?
- Sidebar not displaying (theme development)
- Text widget is placing everything side by side. I want to post it above
- Cold Fusion to WordPress
- is_active_sidebar() problem
- Undefined index: custom_sidebars
- Create new sidebars trough admin post/page metabox
- twitter widget loads properly in all themes except my own theme?
- WordPress Footer Widget Processing
- Custom widget not appearing on front end
- What’s the policy for building a theme that doesn’t support widgets/menus?
- How to Remove Sidebar when get_sidebar() is not get called in page?
- Default calendar widget not showing up
- WordPress two sidebar layout or theme
- WordPress widgets manager option for emulating theme layout
- Custom widgets in theme option page
- Adding custom widgets to theme sidebar on activation
- Conditional tags issue for multiple is_page() conditions in sidebar.php
- Option to show/hide widget depending on is_home?
- Add the title of a widget as an ID – for anchor links
- Incorrect sidebar showing on WooCommerce Store page [closed]