I came up with this to better demonstrate what I intended to do. The example below works but however it obviously 'replaces' the class, where I need it to add the additional class.
In index.php
echo '<main class="' . apply_filters( 'jm_content_area_wrap', 'content' ) . '" role="main">';
Then say in a page template I can use this
// Add .bg-primary class
function jm_test_class( $test_class ) {
$test_class = 'content bg-primary'; // This replaces the .original class, rather than adding to it, so I need to add .content back.
return $test_class;
}
add_filter( 'jm_content_area_wrap', 'jm_test_class' );