Excluding Categories in Wordpress Sidebar Widget
This is a short Youtube video demo on how you can exclude categories from you side bar if using the sidebar widget. This requires us to edit the widgets.php file instead of the sidebar.php file. More how to videos can be found at the Traffic is Gold Youtube channel.
Similar Videos:
Excluding Pages In The Wordpress Sidebar
We also announce our videos on Twitter, you can follow us on Twitter here: @trafficisgold.
Step by Step code credit goes to Lance Hoff
Step 1:
Download widgets.php from here: wp-includes/widgets.php
Step 2:
Find this line of code:
$d = $options[$number]['dropdown'] ? ‘1′ : ‘0′;
under it palce this line of code: $ex = “1,2,3″;
(NOTE: change out 1,2,3 with the actual Categories you want to exclude.)
So all together it looks like this:
$d = $options[$number]['dropdown'] ? ‘1′ : ‘0′;
$ex = “1,2,3″;
Step 3:
Find
$cat_args = array(’orderby’ => ‘name’, ’show_count’ => $c, ‘hierarchical’ => $h);
Replace
$cat_args = array(’orderby’ => ‘name’, ’show_count’ => $c, ‘hierarchical’ => $h, ‘exclude’ => $ex );
Step 4:
Save the file and uplaod back to it’s original location
You are done!!
Again thanks to Lance for the code and his step by step blog post. Please visit the site here.
Related posts:
- Excluding Pages In The Wordpress Sidebar
- Protect Your Wordpress Site From a Malicious Attack
- Future Posting In WordPress (Video)
- Adding YouTube Videos to your Blog Post
- Limit the Number of Pages in Your Wordpress Navigation Bar
- Making WordPress SEO Friendly URLS
- How to Create an Email Signature in Thunderbird
I am passionate about SEO | Social Media | Blogging | Wordpress. Living a good life in Los Angeles with my wife and daughter. I am an internet Marketing consultant who can be hired on an hourly basis. 

