Home / Tech Guide / How to exclude category from displaying on WordPress home page?

How to exclude category from displaying on WordPress home page?

/
/
/
579 Views

Hello, Today we learn how to exclude category from displaying on WordPress Home Page or exclude posts assigned to specific category from displaying on Blog page in WordPress.

  1. Log into your WordPress dashboard, and navigate to Appearance > Editor:

How_to_exclude_category_from_displaying_on_Blog_page.png

2. Choose Current theme name folder, where theme folder is your actual theme number in Select theme to edit drop down:

wordpress_how_to_exclude_category_from_displaying_on_blog_page_1

3. Find custom-function.php or Main function.php file and open to edit it.

wordpress_how_to_exclude_category_from_displaying_on_blog_page_2

4. then You will need to get your category ID before editing this file. You should navigate to Posts > Categories:

wordpress_how_to_exclude_category_from_displaying_on_blog_page_3

5. Hover over the category name (that you want to exclude from blog page) to see its ID:

wordpress_how_to_exclude_category_from_displaying_on_blog_page_4

6. after that you need to Add this code to the function.php end of the file before closing php tag ?> and replace 6 with your category ID:

If you want to exclude 2 or more categories, you should add separate code them with comma in the code, example:

7. after paste above code Click Update file button to save changes.

8. Refresh your WordPress home blog page, now it doesn’t display posts from the category that was excluded in the file.

 

That’s it Thank you for watching @thinknowledge

  • Facebook
  • Twitter
  • Google+
  • Linkedin

Leave a Comment

Your email address will not be published. Required fields are marked *

1 Shares
+11
Tweet
Share
Share
Pin