Skip to content

Instantly share code, notes, and snippets.

@Zodiac1978
Created July 15, 2022 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zodiac1978/f58848785f4b86e4cd201ea35c2bf9da to your computer and use it in GitHub Desktop.
Save Zodiac1978/f58848785f4b86e4cd201ea35c2bf9da to your computer and use it in GitHub Desktop.
Preloading block styles to make WordPress sites faster
<?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