\/script>/i',
// Match script tags without async
'/',
// Replace non-async script tag
'',
// Replace inline push scripts with delayed versions
'',
);
// First pass: replace script tags
$html = preg_replace($patterns[0], $replacements[0], $html);
$html = preg_replace($patterns[1], $replacements[1], $html);
// Second pass: replace inline push calls
$html = preg_replace_callback(
'/';
},
$html
);
// Add a comment to indicate processing occurred
if (defined('WP_DEBUG') && WP_DEBUG) {
$html = str_replace('