Exclude Posts of Certain Categories From The Homepage Of A WordPress Blog
Blogs that are powered by the self hosted WordPress CMS often face a typical problem of hiding posts from the front page. There can be situations when you may not want to show specific posts on your website’s homepage. There are different techniques to exclude specific posts from WordPress homepage. This involves modifying the loop, publishing at an earlier date or using a custom template file for the index page of your website.
However, if you are no geek and need a simple way to exclude specific posts from your website’s homepage, here is a neat trick I recommend implementing.
Note: I have tested this trick on this blog and it works fine, as long as you are not using the default WordPress theme. In some themes, the loop is coded in such a way that this plugin might not work, so you should consult with your theme developer and get the problem solved.
Exclude Posts Of A Specific Category From Your Website’s Homepage
1. Download the Front page excluded categories plugin and upload it to your website’s wp-content folder. You will need an FTP program to upload the plugin files but if you do not have an FTP program installed on your computer, you can upload the plugin zip file from WordPress Administration area > Plugins > Upload.
2. Go to “Manage Categories” within your WordPress administration panel.
3. Create a new category. You will be using this category to hide posts from your site’s index page.
3. Note the unique ID of the category you just created. To know the Category ID’s of any of WordPress Categories, simply hover the mouse cursor over the category name and you will see the category ID in the browser status bar. An example is shown below:

4. Within your WordPress administration area, open the plugin editor and select the “FrontPage excluded Categories” option from the right top drop-down menu. Be extremely careful while you are editing a plugin file, it is advised to take a backup before proceeding.
5. Find the String $cats_to_exclude and include your category ID’s by separating Commas.

You can exclude only one category or choose to exclude multiple categories from WordPress home page. Just separate each category with a comma and update the plugin file.
When you are done editing the plugin, visit your site’s homepage and you will find that the posts that were assigned the specific category, are not showing up on your website’s homepage. This is because you have purposefully excluded all posts of a specific category from appearing on your site’s index page, thanks to the Front page excluded categories WordPress plugin.
What About Multiple Categories That Have been Assigned to A Post?
Fair question. The plugin goes to work even if you have assigned multiple categories to a specific post. Let us assume that you have excluded posts of “X” category from showing up on your site’s homepage. Later, if you create a post and assign three categories e.g “X”, “Y” and “Z” to it, that post will still be excluded and wont appear in your site’s homepage.
This is applicable to all the other archive pages if the same loop is active on the tag, category, author and date based archives. However, if all the archive pages are made up of differently coded loops, you’re out of luck.
Duplicate content issues
If your site is coded in such a way that multiple categories contribute to duplicate content issues, you should not use this trick. Better, never assign multiple categories to a post if your site’s permalink structure contains the category slug in the post URL.
In those situations, it makes sense to exclude posts of a specific tag from your site’s homepage. This involves tweaking the loop but it is actually worth it.
Do you know any trick or other plugin that does a similar Job or even better ?Share your ideas in the comments section.



Hey, Nice Post and very Help ful! THanks! :)
Hi, I tried it but it didn’t work, my WP version is 2.7.1. I followed everything but still it didn’t. Here’s what I did:
function fpe_where($where) {
// Change the $cats_to_exclude string to the category id you do not want to appear on the front page.
// Example: $cats_to_exclude = ’1, 2, 3, 4′;
$cats_to_exclude = ’7, 8, 9, 10, 11, 13, 14′;
global $wpdb, $wp_query;
if (! $wp_query->is_home || strlen($cats_to_exclude) == 0) {
return $where;
}
if (empty($wpdb->term_relationships))
{
$where .= ” AND $wpdb->post2cat.category_id NOT IN (” . $cats_to_exclude . “)”;
}
else
{
$where .= ” AND $wpdb->term_taxonomy.term_id NOT IN (” . $cats_to_exclude . “)”;
}
return $where;
My category IDs are 7, 8, 9, 10, 11, 13, 14. Did I place it correctly? Also, this plugin is already activated in my WP admin site.
@ Ryan : Sorry to Hear That it didn’t worked.Your plugin code is correct. Try disabling other Plugins to see if there is a Conflict or not. What do you mean By “activated in wp-admin” site ?
Thank you Amit for your promt response. The only active plugin that I have enabled aside from this is Askimet.
I forgot to tell you am using the Sliding Door theme, see my blog at http://www.framedinsunlight.com. I think it has to do something with this theme that’s why it’s not working.
@Ryan : If That be the case then You have to look In your theme’s Source and edit if Necessary. Have You tried to switch To The WordPress default theme and See whether The plugin Works or not ?
Has anyone found a solution to this yet? It doesn’t work in my wp version 2.8 either. My template is soho-serenity.
@geejay : But it works for me and i am also using wordpress 2.8. Did you edited the Plugin editor ??
I got it working after several hit and misses. What I did was removed the “tags” from the blog posts I want to appear on the categories. Those with tags appeared on my front page. Try it, it worked for me. :)
Surpring issue : Never had any Problems with that Plugin. I think there was something problematic with your theme. ANyway Its nice that your problem is fixed . Keep rocking Ryan !
Thanks for the suggestions. Let me go check if they work with my template.
Interesting plugin thanks! Just hope it work for me
@Insurance Guy Oh sure, It has worked for many others.