/ Published in: PHP

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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* 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');
URL: http://www.brettwidmann.com/2011/12/filter-categories-wordpress-blog/
Comments
