Excluding top level from taxonomy and post loop

For reference of other I’ve managed to get help with this with help from wordpress support forums.

You can specify a second parameter in get_terms to exclude specific term IDs:

$term_args = array( ‘exclude’ => array(5, 8) );
$custom_terms = get_terms(‘service_categories’, $term_args);

In the case above, we’re excluding terms with ID 5 and 8.


I added the code above before the foreach and it worked perfectly.