Show only the sub-categories (and their content) of the current custom taxonomy with ‘taxonomy.php’

I think you can easily achieve that if you understand WordPress template hierarchy.

Looking at the template hierarchy diagram, and assuming you have categories and sub-categories, then you can achieve what you want in multiple ways.

Suggestion 1

  1. Use category.php to display the posts of any category, including sub-categories.

  2. also in category.php add a condition at the top to detect if it is a “parent” category. If so, then display the sub-categories of that parent category.

Suggestion 2

  1. Use category.php to display the posts of any category, including sub-categories.

  2. Use category-$slug.php for the parent category, and use it to display the sub categories for that parent.

I think suggestion 2 would be OK if you have one, or two parent categories. Because every time you add a new parent category, you have to create a new category-$slug.php file for it. So if you have many parent categories to be created, then use suggestion 1.

Also, you can use the same solution for custom taxonomies as well, but use the hierarchy diagram to understand taxonomy files (i.e., use taxonomy.php, taxonomy-$taxonomy.php and taxonomy-$taxonomy-$term.php depending on your needs).