Prefetch a list of URLs

[ad_1]

By prefetched do you mean “precached“?

Yes, sorry, there is the rel=prefetch thing I was looking into, so I posted that way.

You can see documentation for this in the wiki under Route Caching API. In particular, here’s how you would precache an image:

<?php
add_action( 'wp_front_service_worker', function( \WP_Service_Worker_Scripts $scripts ) {
	$scripts->precaching_routes()->register(
		'https://example.com/wp-content/themes/my-theme/my-theme-image.png',
		array(
			'revision' => get_bloginfo( 'version' ),
		)
	);
} );

You can duplicate that register call as, any times as you need.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer