I have a custom taxonomy “role” for my custom post type “People”.
When listing the roles, is there a way to exclude roles based on slug and not ID via get_terms
function?
I ask because I’m running a multisite and a few websites have the same IDs as the ones I’d like to exclude.
Right now I have:
<?php
$roles = get_terms(
'role', array(
'orderby' => 'ID',
'order' => 'ASC',
'hide_empty' => true,
'exclude' => array('58', '63', '833'),
));
$count_roles = count($roles);
if ( $count_roles > 0 ) : ?>
//do stuff
<?php endif;?>
The slugs I’d like to exclude are: 'slug' => ['graduate', 'job-market-candidate', 'graduate-student','research']
, but I don’t know where to fit this line, if anywhere.
Any help is appreciated!