Exclude category from wordpress blog page

This has been an issue i’ve been working through for some time. There are no easy to use plugins to do this. So here’s how you do it.

    1. Find your blog category id by editing one of your categories
    2. Edit your functions.php with the folowing code. Replace xx with your category id
function exclude_category($query) {
if ( $query->is_home() ) {
$query->set('cat', '-xx');
return $query;
add_filter('pre_get_posts', 'exclude_category');


Leave a Reply