Do you want to display specific category but not it’s child categories in your WordPress blog or website? Then you came to the right place.
Here we have posted the code and its guide to exclude subcategories of the parent category. Just follow the below guide.
Let’s not waste time and get to the point.
Exclude child category WordPress
Below we have embedded the code snippets that you need to put in your WordPress theme. For that: copy the below code and paste it into your theme’s functions.php file.
After that, Change the category id to your category id which child categories you don’t want to display.
Code to Exclude child categories of a Specific Category
Hope the above code work well to you, if you have any questions or opinion about this post, please let us know in the comment below. Also, do share this guide on social media website.