How do I exclude testimonial categories from Category widget

Add the following to your theme’s functions.php file:

function exclude_widget_categories( $args ) {
    // Make sure to replace the category IDs 8,10 with yours.
    $exclude                    = '8,10';
    $args['exclude']          = $exclude;
    return $args;
}
add_filter( 'widget_categories_args', 'exclude_widget_categories' );