Well I mean I am not a coder but I asked ChatGPT and in 10 seconds it produced this for all inline:
add_action('template_redirect', function () {
ob_start(function ($html) {
// Match all <style> tags (in head or body)
preg_match_all('/<style.*?>(.*?)<\/style>/is', $html, $matches);
if (!empty($matches[1])) {
$css = implode("\n\n", $matches[1]);
// Save to a CSS file (e.g., /wp-content/uploads/inline-css.css)
$file_path = WP_CONTENT_DIR . '/uploads/inline-css.css';
file_put_contents($file_path, $css);
// Remove all inline <style> blocks
$html = preg_replace('/<style.*?>.*?<\/style>/is', '', $html);
// Add link to new external CSS file in head
$link_tag = '<link rel="stylesheet" href="' . content_url('uploads/inline-css.css') . '">';
$html = preg_replace('/<\/head>/', $link_tag . "\n</head>", $html);
}
return $html;
});
});
So I think with 2 minutes of your team looking at it, you could provide something useful?