Subscribe via RSS Feed Connect on Google Plus

Exclude category from homepage

4 March, 2015 0 Comments

To exclude some categories from the the loop on the frontage, you can use this snippet in your function.php.

function excludeCat($query) { if ( $query->is_home ) { $query->set(‘cat’, ‘-3,-5,-23’); } return $query; } add_filter(‘pre_get_posts’, ‘excludeCat’);

Filed in: Wordpress

About the Author:

Leave a Reply

Seo wordpress plugin by