Return to Snippet

Revision: 54366
at December 21, 2011 15:08 by goatboy91587


Initial Code
/* The Number 611 is my category ID number. Please replace this with your own! 
           Add this snippet to your functions.php file. */

        function exclude_cat($query) {
		if ( $query->is_home) {
			$query-> set('cat','-611');
		}
		return $query;
	}

	add_filter('pre_get_posts','exclude_cat');

Initial URL
http://www.brettwidmann.com/2011/12/filter-categories-wordpress-blog/

Initial Description
Ever want to filter out a category from your blog page. Here's how you do it! Just add this snippet to your functions.php file.

Initial Title
Filter Category from WordPress Blog Page

Initial Tags
wordpress

Initial Language
PHP