mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-28 11:22:21 +08:00
12 lines
469 B
Text
12 lines
469 B
Text
function wt_cli_add_rel_preload($html, $handle, $href, $media) {
|
|
$preload = array(
|
|
'cookie-law-info',
|
|
'cookie-law-info-gdpr',
|
|
'cookie-law-info-table'
|
|
);
|
|
if (in_array($handle, $preload)) {
|
|
return '<link rel="preload" as="style" onload="this.onload=null;this.rel=' . "'stylesheet'" . '" id="' . $handle . '-css" href="' . $href . '" type="text/css" media="all" />' . "\n";
|
|
}
|
|
return $html;
|
|
}
|
|
add_filter( 'style_loader_tag', 'wt_cli_add_rel_preload', 10, 4 );
|