Exclude specific slug in 'get_terms'

by timmyg   Last Updated May 24, 2018 16:08 PM

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!



Related Questions


Generate Random Slug When Adding Taxonomy

Updated February 15, 2018 01:08 AM


Get custom category image from menu

Updated August 06, 2015 14:03 PM

add_action priority and taxonomy used in plugin

Updated July 17, 2015 15:03 PM

What is wp_insert_term "alias_of" arg for?

Updated February 16, 2016 16:03 PM