Created
July 15, 2022 16:10
-
-
Save Zodiac1978/f58848785f4b86e4cd201ea35c2bf9da to your computer and use it in GitHub Desktop.
Preloading block styles to make WordPress sites faster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add some preloading | |
* @link: https://www.phpied.com/faster-wordpress-rendering-with-3-lines-of-configuration/ | |
*/ | |
function hints() { | |
$wp_version = get_bloginfo( 'version' ); | |
header( 'link: </wp-includes/css/dist/block-library/style.min.css?ver=' . $wp_version . '>; rel=preload' ); | |
} | |
add_action( 'send_headers', 'hints' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment