Last active
December 25, 2015 01:39
-
-
Save 3200creative/6896267 to your computer and use it in GitHub Desktop.
Exclude particular category from posts archive - WordPress
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
//* Hide Category from Home Archive | |
add_action( 'pre_get_posts', 'be_exclude_category_from_blog' ); | |
function be_exclude_category_from_blog( $query ) { | |
if( $query->is_main_query() && $query->is_home() ) { | |
$query->set( 'cat', '-4' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment