Created
September 10, 2014 18:01
-
-
Save renventura/a4696c3c3ddb829bb42d to your computer and use it in GitHub Desktop.
Remove Specific Post Categories from the Blog Index
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
<?php //* mind this opening php tag | |
//* Exclude categories from blog page | |
add_filter('pre_get_posts', 'rv_exclude_blog_categories'); | |
function rv_exclude_blog_categories($query) { | |
if ($query->is_home) { | |
$query->set('cat', '-1,-2,-3'); //Replace with your category numbers (keep negative signs) | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment