How to Hide Category from WordPress Blog Page

Home » Blog » Tutorials » How to Hide Category from WordPress Blog Page

By default, WordPress blog shows all posts from all categories. But in some situation you want to exclude posts from specific category.

To hide category from WordPress blog page we need to modify WordPress loop.  We will modify the loop by using pre_get_posts hook.

Add following code snippet in you themes functions.php file. Replace category ids with the category id want to exclude.

You can obtain category id by editing category. You will find category id in URL.

How to Hide Category from WordPress Blog Page

 

Leave a Comment

Request a Quote