How to display only a specific category posts on WordPress Homepage?

  1. Open Your wordpress dashboard
  2. Select “Appearance” – > theme file editor ->Theme Function ->functions.php
  3. Add the following code to the file and save the php file.

How to display only a specific category post on WordPress Homepage
How to display only a specific category post on WordPress Homepage

 

  1. Find the category ID by visiting to Posts, and then Categories in your WordPress dashboard.
  2. Select the category you want to use.
  3. The ID will be displayed in the URL at the top of the screen, For example in my case, URL is https://mianwalijobs.pk/wp-admin/term.php?taxonomy=category&tag_ID=29, and the given ID is 29.
  4. Replace ‘category_id’ with the ID of the category you want to display and save it.

    Showing pecific category post on WordPress Homepage
    Showing specific category posts on WordPress Homepage
  5. Reload your homepage to see the posts from only your selected category.