Sign Up For Web Hosting Now!
WordPress Services
No.1 Wordpress Host
  • Free Domain name
  • Unlimited space
  • Unlimited traffic
  • 99.9% Server Uptime
  • FREE WP installation
  • Wordpress themes
  • Immediate activation
Buy web hosting
Sign up now Learn more
WordPress Hosting Award
WordPress Hosting Award
Facebook Twitter Plusone

How to hide specific category from posts page

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 sites 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.
Previous Next
(c) Copyright 2004-2013 SiteGround. All rights reserved
WordPress is a trademark of Free Software Foundation, Inc. SiteGround is not affiliated with or endorsed by the WordPress Project or its trademark owners.