From this tutorial you’ll learn how to show Parent category products only without products from subcategories.
Excluding Subcategory Products from Parent Category Products List
- First, let’s log in to WordPress Dashboard. Here you need to open Appearance > Editor tab on the left.
- Locate functions.php file in the column on the right of the Editor page.
- Scroll the content of the file to its end, and paste the following lines of code at the end of the code.
- Click on Update File button to save the changes.
- As a result, you’ll see only the products assigned to the parent category on the corresponding website’s page.