Many of you have found the post on excluding categories from you blog very helpful. However, what happens when you want to exclude posts with a certain tag from appearing on the blog? Well, thankfully that is an extremely simple operation.
The first thing you have to do is figure what the tag id is. Simply go to Posts->Post Tags and hover over the name of the tag. Look at the bottom of the browser window (in the status bar) and look at the number on the end.

If you are confused, watch this video.
Next, open up custom_functions.php and enter the following (yes, that is two underscores between tag__not ):
function exclude_tag($query) {
if ( $query->is_home) {
$query-> set('tag__not_in',array(ID));
}
return $query;
}
add_filter('pre_get_posts','exclude_tag');
Where I have ID, you should have the number for the tag you want to exclude. For instance, 24 or 1. It is very important that you do not put apostrophes around the number. Also, if you want more than one tag, you would do the following:
function exclude_tag($query) {
if ( $query->is_home) {
$query-> set('tag__not_in',array(ID, ID, ID, ID));
}
return $query;
}
add_filter('pre_get_posts','exclude_tag');
That is pretty much all there is to it!
Remember, if you don’t have the Thesis Developer’s License, you are really missing out!
{ 3 comments… read them below or add one }
Hi
We have developed a new wordpress plugin and we are looking for people to beta-test it.
The plugin is about wordpress/twitter and you can check it at both links:
http://tweetandgetit.com/wordpress-plugin
http://viuu.co.uk/blog/wordpress-plugin/
You can also email us at:
marie@viuu.co.uk
Good, simple Thesis theme tutorial Matt. Like your blog here. You design Thesis theme skins too?
Hi,
I have been having this problem for some time. I couldn’t myself around it. I have sliders on my home page and what I post on there are into one single category “Uniquely Featured” which I used a widget to make it invisible on my Categories sidebar. I also tagged it “featured” to make posts easier to put to sliders. Because I have a slider on my home page and I also have a Recent Posts right below the slider, it is redundant to have things appear twice in a single page. So is there a way not to include anything tagged “featured” or exclude a single category “Uniquely Featured – Category ID 1″ from appearing on my recent post section?
It would be great if you can help me out on this.
Thanks
Leoncio