Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Exclude a Category’s Posts from the Home Page in WordPress

October 10, 2014 Leave a Comment

To exclude a certain Category’s posts from the home page you just need to know the category ID and then use a filter on the pre_get_posts hook to exclude those posts.

To find the ID for the Category just go to the Category and hover over the edit button and the ID appears in the URL at the bottom.

wordpress-category-id

//Exclude Category Posts from Home Page
function themeprefix_exclude_category($query) {
	if ( $query->is_home() ) {
	$query->set('cat', '-338');//add your category number
	}
	return $query;
}
add_filter('pre_get_posts', 'themeprefix_exclude_category');

Then add the function inside your functions.php file. The above function only runs on the home page and will remove any posts that belong in the category numbers listed. In the exmple above that would be number 338, to exclude more than one category just comma separate all the ID numbers like so; ‘-338, -340, -350’

Cats: WordPress

Tags

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls

Donate a Beer to the Coolest Guides

Get Beaver Builder Now!

Discuss

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls
Get DesktopServer

Lynda

Lynda.com Online Training Videos

TreeHouse

smlinks

Learn WordPress
osx-modify-shell-path

How to Add to the Shell Path in macOS Big Sur and Catalina using Terminal

October 19, 2019

virtual-hosts osx 10.10 yosemite

Set up Virtual Hosts on macOS Catalina 10.15 in Apache

October 19, 2019

Installing Homebrew on macOS Catalina 10.15, Package Manager for Linux Apps

October 18, 2019

Where is the bash shell in macos Catalina?

October 12, 2019

Refine your search

  • All
  • Modules
  • Themes
  • Documentation
  • Forums & Issues
  • Groups

RSS ars technica

  • Six things I'll remember when I think about Tim Cook's version of Apple
  • Why are the Mac mini and Mac Studio gradually becoming impossible to buy?
  • Apple stops weirdly storing data that let cops spy on Signal chats
  • John Ternus will replace Tim Cook as Apple CEO
  • Apple chooses Amazon satellites for iPhone, years after rejecting Starlink offer

RSS mac surfer

  • iOS 27 Camera App Gains Siri Mode With Visual Intelligence
  • Apple Loses Bid to Pause App Store Changes in Epic Case
  • iOS 27 to Overhaul Photos App With AI Editing
  • Tim Cook Attends White House for King Charles State Visit
  • Apple Defeats California App Store Favoritism Bill

Donate

Copyright © 2026· Neil Gee - All Rights Reserved - Hosted by Runcloud

Copyright © 2026 · gee on Genesis Framework · WordPress · Log in