-
-
Save cre8tivediva/77c2a2ae015da070f4529a2a88ac49b4 to your computer and use it in GitHub Desktop.
Exclude Category from Home Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Exclude Category from Home Page | |
function c8d_exclude_category_homepage( $query ) { | |
if ( $query->is_home) { | |
$query->set( 'cat', '-1' ); // Change this number to the category ID you wish to exclude | |
} | |
} | |
add_action( 'pre_get_posts', 'c8d_exclude_category_homepage' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment