It’s obvious that we all have selected different themes for our website or blogs and all these themes have default settings to show certain categories on homepage. Most of the themes we came across displayed the recent articles from all the categories.

But at times we want some category post to appear in the sidebar and not on the home page main screen. i.e same as saying that you want to display only particular categories on the homepage or exclude certain categories from home page.

So let’s begin!

Step 1: Open your WordPress Dashboard.

Step 2: Navigate to Appearance > Editor.

remove category 1

Step 3: On right side you will see on list of PHP files. Locate the functions.php and open it.

If your Dashboard does not show Editor then you will have to access the functions.php through the FTP of your website. Rest all steps would remain the same.

Caution: The file that you will be modifying is the Theme’s Function File. So make sure you do not modify anything else.   remove category 2

Step 4: Before proceeding further you would need to identify the Id/number of the category which you want to exclude. For this navigate to  Dashboard > Posts > Category.

remove category 3

Step 5: Open the category you want to exclude. Now, in the URL you will see tag_ID which is your category ID.

remove category 4

Now once you have the Tag_ID let’s proceed further.

Step 6: Copy the code below at the end of functions.php

You will have to replace the category number with the tag_ID of the category you want to exclude. Don’t remove that ‘-‘ from its place. It indicates that we want that category to exclude from the list.