add_filter( 'style_loader_tag', 'add_attribute', 10, 2 );
function add_attribute($link, $handle) {
if( $handle == 'fontawesome' ) {
$link = str_replace( '/>', 'integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous" />', $link );
}
return $link;
}