Skip to content

Snippet: Exclude Terms from the Navigation Bar

If you are using the Navigation Bar element to display terms (such as categories) rather then selecting a custom menu, by default, the theme will display all terms. However, you can easily exclude terms by hooking into the "vcex_navbar_get_terms_args" filter which returns the arguments for the core get_terms function.

 * Exclude Terms from the Navigation Bar
 * @link
add_filter( 'vcex_navbar_get_terms_args', function( $args ) {
    $args['exclude'] = [ 1 ]; // array of excluded terms
    return $args;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top