Recently when I was working on some C++ tutorials on recursion and published 30 Best recursive Programs in C++ then suddenly realized that this is not my niche on binarynote. Most of the time these tutorials will contain codes.
But before that let’s concentrate on our main problem first-How to hide category posts from front page. Right now I have more than one solution for this issue.
Hide category Posts from front Page using Ultimate Category Excluder plugin
Ultimate Category Excluder, abbreviated as UCE, is a WordPress plugin that allows you to quickly and easily exclude categories from your front page, archives, feeds, and searches. Just select which categories you want to be excluded, and UCE does all the work for you!
The above screenshot will help you a lot to understand how much and how you can hide from your website front end.
Hide Category posts from Front Page without Plugin
As you are already aware that installing too much plugins for each and evry small issue is not a good idea as each plugin store its settings and other option values in wp_option database and when any one access any page from your website the whole database specially this wp_option is queried again and again , Thus it increase the page loading time of your website.
You can also read my post on how to reduce page loading time. So here we will explore the WordPress hooks to filter our data, so that we can hide category post from front page.
pre_get_post hook execute every time before sending any data to the global $query variable.
But before that you have to find out what is the category ID of your desired category.
To know category ID of your category just hover the mouse on the category name and its ID will be visible at the status bar of the WordPress admin Panel.
Now open your theme’s functions.php file and paste the following code
In the above code (-) minus sign is compulsory otherwise above code will not exclude any post from the frontpage. If you want to exclude more than one category then there is no need to pass array, just separate your categories with comma(,) like this
The Whole concept was developed by the man you are watching here. I am rakesh Kumar Serial Niche Blogger and SEO Enthusiast. find me onfacebookandon twitter.. Developed popular WordPress theme for Wallpapers and funny Image WordPress theme. Love SEO optimized WordPress theme Designing and Customization.