• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WPArena

WPArena

WPArena is a premium online resource site of WordPress and is focused on providing excellent WordPress Tutorials, Guides, Tips, and Collections.

  • News
    • Opinion
  • Tutorials
  • Reviews
    • Themes
    • Plugins
  • Comparisons
  • Collections
    • Education Themes
    • Genesis Child Themes
    • Best Responsive Themes
    • Medical WordPress Themes
    • Finance & Business Themes
    • Crowdfunding Themes
  • Resources
    • Inspiration
  • Services
WPArena » Tutorials
Tutorials

How to Exclude a Category from the Home Page

Avatar of Noor Mustafa Raza Noor Mustafa Raza Updated: May 31, 2017

FacebookTweetPinLinkedInEmailPrint

This is the most common customization requests for WordPress, “How do I prevent posts from a particular category from displaying on my home page?” As I have a category about WordPress Product lists “Collections” and I want to omit it from the post loop so that posts from this category will not display on my Home Page. But this post will still appear in your content field. To eliminate from feed and from Hope page there is excellent WordPress plugin Stealth Publish.

excluded

The simplest way for including and excluding a Category post from Home page is to modify the query_posts function as follow:

Excluding a category from the home page

<?php if ( is_home() ) {

query_posts( '&cat=-4' );

}

// your usual Loop can go here

?>
Where 4= The required Category ID and that Id you can find in category section. Go to Category click on Edit and in URL you can find Category ID as shown in the picture below.
Category-ID

In query_posts( ‘&cat=-4‘ ), a dash (or minus sign, “–“) appearing before a parameter value signifies exclusion. Thus, here I wanted to exclude a category number four, When this code is placed before my loop, posts in Collections category will not be displayed.

Showing Only One Category on the Home Page

The above solution was for my own problem, Perhaps instead of excluding a category, you want to show only one category. Than there is minor change in the query_posts, All you have to replace the dash (or minus sign, “-“) as follows:

Showing only one category

<?php if ( is_home() ) {

query_posts( '&cat=7' );

}

// your usual Loop can go here

?>

Be careful, and proofread your Loops!
If you are not familiar with coding than the best option is to use WordPress Plugins for that purpose.

WordPress Plugins for Excluding Category

1. Stealth Publish

Prevent specified posts from being featured on the front page or in feeds. Beneficial in instances where you want to publish new content without any fanfare and just want the post added to the archive and category pages and its permalink page.

2. Simply Exclude

Provides an interface to selectively exclude/include categories, tags, authors and pages from the 4 actions used by WordPress. Simply Exclude is a WordPress plugin that allows you to quickly and easily exclude categories from your front page, archives, and feeds. Just select which categories you want to be excluded, and it does all the work for you!

3. Advanced Category Excluder

This plugin was born because there was a no other real alternative to enable content separation and some CMS like functionalities in WordPress. The main goal was, to enhance WordPress’s features, to hide some unwanted categories, from defined parts of the blog.

4. Ultimate Category Excluder

This is a WordPress plugin that allows you to quickly and easily exclude categories from your front page, archives, and feeds. Just select which categories you want to be excluded, and UCE does all the work for you!

This post was orginally published on: August 19, 2010 and was updated on: May 31, 2017.
FacebookTweetPinLinkedInEmailPrint

Related Stories

  • How to Boost Facebook likes of your WordPress site

    How to Boost Facebook likes of your WordPress site

  • Where To Find Free WordPress Themes

    Where To Find Free WordPress Themes

  • How To Clean WordPress Database

    How To Clean WordPress Database

Avatar of Noor Mustafa Raza

Noor Mustafa Raza

Ex-Editor in chief

I am a WordPress Developer and Designer, author @WPArena. I am providing Free WordPress consultation and can help you to install WordPress in a secure way to small businesses and bloggers.

Reader Interactions

Share Your Thoughts Cancel reply

Before submitting your comment, we kindly ask that you read our comment policy. Your email address will remain confidential and will not be published or shared anywhere. If you subscribe, you will receive notifications regarding new comments.

Primary Sidebar

Identifying, Removing, and Preventing Malware on Your WordPress Site

Crowdfunding WordPress Themes

15+ Best Crowdfunding WordPress Themes

Recent Topics

  • Top Premium WordPress Plugins & Themes
  • How to Improve WordPress Navigation Menu
  • Publishing Blog Posts via Email: WordPress and Blogger
  • Ultimate Guide to Managing WordPress Multi Sites
  • 27 Top SEO Companies in the World

Footer

Top

  • Services
  • Our Themes
  • Facebook
  • Twitter
  • Linkedin

Reviews

  • Beaver Builder Review
  • Beaver Themer Review
  • WP User Frontend Pro
  • Ninja Forms Review
  • MemberPress Review

More Reviews »

Resources

  • Best WordPress Plugins
  • WordPress Permalinks Structure
  • Email Management System
  • Envato Free Files
  • Advertise
  • Write for us
  • Disclosure
  • Terms
  • Privacy
  • Contact

Copyright © 2023 · All Rights Reserved · WPArena is a Project of TechAbout LLC.
We are not affiliated with Automattic or WordPress.

  • Advertise
  • Write for us
  • Disclosure
  • Terms
  • Privacy
  • Contact
Share this ArticleLike this article? Email it to a friend!

Email sent!