Preload key requests using wp_enqueue


I’m currently doing some speed optimisation and one of the main things scoring the site down is:-

“Preload key requests 2.64 s
Consider using to prioritize fetching resources that are currently requested later in page load. Learn more.

I enqueue all my styles and JS files in my functions.php as follows:-

wp_register_script('jquery-ui', get_template_directory_uri() . '/assets/js/jquery-ui.min.js', array(), '1.12.1');

wp_register_style( 'jquery-ui-css', get_template_directory_uri() . '/assets/css/jquery-ui.min.css', array(), '1.12.1');
wp_enqueue_style( 'jquery-ui-css' );

How would I go about using rel="preload" with some of these files?

nsilva 3 weeks 0 Answers 4 views 0

Leave an answer