Last active
July 26, 2016 09:09
-
-
Save calvez/edf9825379f54d613903b9c6a2a64158 to your computer and use it in GitHub Desktop.
Filter posts by category on frontpage wordpress 2.9+
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
// ========================================= | |
// = Filter posts by category on frontpage = | |
// ========================================= | |
function exclude_category($query) { | |
if ( $query->is_home() ) { | |
$query->set('cat', '-6'); | |
} | |
return $query; | |
} | |
add_filter('pre_get_posts', 'exclude_category'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment