How To Hide a WordPress Category Posts?

Sometimes, when you display certain posts on your WordPress powered site you may need to hide speciffic categories from posts pages. This is needed because categories are often used as system "markers" in site's structure.

To do this, enter the following lines above the Loop (check out this tutorial for more information on What is The Loop):

<?php if (is_front_page() && !is_paged() 
) $posts = query_posts($query_string . '&cat=-33,-66'); ?>

This prevents posts from categories 33 and 66 from appearing in the list of posts.

WordPress is a trademark of WordPress Foundation. SiteGround is not affiliated with or endorsed by the WordPress Project or its trademark owners.