从列表中排除类别-Wordpress


Exclude category from list - Wordpress

我正试图将一个类别从以下列表中排除:

<?php
    $categories = get_categories( 'orderby=id&exclude=1,'. getOption('promo-categorie', false) );
    foreach( $categories as $category ) :
        $active = ( !is_home() && get_query_var( 'cat' ) == $category->term_id )? ' style="color: ' . getOption($category->category_nicename . '-color', false) . '"' : '';
        $catLink = ( get_query_var( 'cat' ) == $category->term_id ) ? get_bloginfo( 'wpurl' ) : get_category_link( $category->term_id );
?>
  <a class="nav-links" href="<?php echo ( get_query_var( 'sort' ) == 'list' )? add_query_arg( array( 'sort' => 'list' ), $catLink ) : $catLink ?>" <?php echo $active; ?>><?php echo $category->name; ?></a>
<?php
    endforeach;
?>

我是一个完全的PHP新手,但据我所知,"promo-categorie"被排除在外。此外,我想排除另一个类别。

如有任何帮助,我们将不胜感激。

您可以排除数组中的id。您可以在排除参数(如)中传递多个ID

$args = array(  
    'hide_empty'               => 1,    
    'exclude'                  =>array(1,2,3) // desire id
); 
$categories = get_categories($args );