Exclude multiple terms using get_terms() function

Soution for : exclude multiple terms using get_terms() function

With get_terms(), the exclude parameter takes an array of term IDs, so just add the second term to the array:

$terms = get_terms( 'product_cat', array(
    'orderby'    => 'name',
    'order'      => 'ASC',
    'hide_empty' => 0,
    'exclude' => array( 23 ),
    ));

echo '
  • Category:
  • '; foreach ( $terms as $term ) { echo '
  • '.$term->name.'
  • '; }

    No comments:

    Post a Comment