How to Exclude a Category from Your WordPress Homepage
WordPress comes with a set of pre-existing categories that are displayed on your website’s homepage. Not every use makes use of all the categories and hence you should know how to exclude a category from the homepage of your WordPress’ websites.
Why Exclude a Category?
The category option on the homepage of WordPress lets you sort your content accordingly. Now, the number of unwanted categories already present can make this sorting process less efficient or you might not find a desired and relevant category pre-existing on the homepage. This is where you should know how to exclude a category or alter the section.
Read along to find out 2 methods of carrying this task out.
Method 1: Plugin Method
To carry out this method the first step is to install the Ultimate Category Excluder plugin from WordPress. Upon installation, head over to Settings » and then click on the “Category Excluder” option. This will create a popup which will then display all the available categories for your WordPress website.
From this point on the work gets easy. You can now simply exclude a category or multiple categories using the “exclude from page” option. Finish this by clicking on “update” to save your new settings. All you have to do now is visit your WordPress website to view your preferred categories being displayed on the front page.
Method 2: Exclude Using Code
For this method, you need to add code to your files on WordPress. Add the following codes to your theme’s functions files or simply to a plugin which is site-specific.
Change the ID (-5) by adding your preferred category ID. This will result in hiding of all blog posts of this ID.
In case you want exclusion of multiple IDs then instead of (-5) you should replace (-5, -4…) with the category IDs of your preference.
We hope these methods were explained in the most understandable jargon and you learned the successful exclusion of undesired categories. Follow us for more such relevant and useful articles.