How to Exclude Posts of Certain Categories from Your Blog’s homepage

Written by Amit Banerjee on 4 Feb, 2009 Under Blogging

This Smart WordPress plugin lets you Exclude posts from a certain category from appearing in the Home page.

Installation

1.Download the Front Page Excluded Categories plugin and Upload it to your Wp-content Folder

2.Go to “Manage Categories” from WordPress Admin panel.If you are Using WordPress 2.7+ you will Find it from “Posts-Categories”.

3.Note the Category ID’s you wish to Exclude from your Blogs Homepage.To know the Category ID’s of your Categories Just Hover the Cursor over your Desired category and you will see the ID in the Status bar.

category ID

4.Open the plugin Editor and Select the “FrontPage excluded Categories” for Editing.Find the String $cats_to_exclude and include your category ID’s by separating Commas.

front page exclude categories2

That’s it.Now Save the plugin and Visit Your Home page.

Do you know any other Plugin that does a Similar Job or even Better ?

  1. Reader Comments

  2. Hi, cool site, good writing ;)

    February 9th, 2009
  3. Hey, Nice Post and very Help ful! THanks! :)

    April 9th, 2009
  4. 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.

    June 16th, 2009
  5. @ 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 ?

    June 17th, 2009
  6. Thank you Amit for your promt response. The only active plugin that I have enabled aside from this is Askimet.

    June 17th, 2009
  7. 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.

    June 17th, 2009
  8. @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 ?

    June 17th, 2009
  9. Has anyone found a solution to this yet? It doesn’t work in my wp version 2.8 either. My template is soho-serenity.

    July 20th, 2009
  10. @geejay : But it works for me and i am also using wordpress 2.8. Did you edited the Plugin editor ??

    July 20th, 2009
  11. 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. :)

    July 20th, 2009
    • 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 !

      July 21st, 2009
  12. Thanks for the suggestions. Let me go check if they work with my template.

    July 21st, 2009
    • Thanks for your kind words & I’m pretty sure that that this will work for you. Whatever if it doesn’t, feel free to ask we will reply ASAP. Thanks again & keep coming.

      July 21st, 2009
  13. (…) though unrelated to this web site, still http://www.ampercent.com is one another interesting source of tips on this topic(…)

    December 2nd, 2009
  14. (…) though unrelated to this web site, still http://www.ampercent.com is one another nice source on this subject(…)

    December 2nd, 2009
  15. Interesting plugin thanks! Just hope it work for me

    January 13th, 2010
    • @Insurance Guy Oh sure, It has worked for many others.

      January 13th, 2010

Add Your Comment

All Comments are Moderated.

YOUR COMMENT



About This Site

Ampercent is a technology blog on computer tutorials, software guides, how to tricks and web tools. The blog is updated daily and written by two computer science students from India. Read More »



Subscribe to RSS Feed

Join Our Community

Submit Product For Review

Want a Software or a product to be reviewed ? Tell us about it, we will do the rest.