Remove A Category From Your WordPress Home Page

Being that I’m pushing out a lot more content these days per my LL3 Training, I really don’t want to go through the hassle of finding an image for everything though I did find this post that helps with images. I put all of my short posts without images in a category of “Tips” and then needed to figure out how to remove that category from the Main Index php page. I found the answer pretty quick and here it is:

<?php query_posts($query_string . '&cat=-3,-8'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

Simply find the second line (which will nearly always be in your index.php page unless you have a more advanced theme), and then put in the first line above it. Make sure you change the -3,-8 to represent the category ID of the taxonomy (category or tag) that you want to remove.

Essentially what this does is change the query by concatenating the &cat= filter to it. Quick and simple, and works like a champ!

Of course you can find more info on the Codex here: http://codex.wordpress.org/The_Loop#Exclude_Posts_From_Some_Category

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>