Hi,
I would like to try to preload my images to improve the speed of my site, especially LCP. I think there is no site-wide solution as some plugin, etc., so my friend created a custom code for it:
add_action( 'wp_head', function(){
$featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'full');
echo '<link rel="preload" as="image" href="'.$featured_img_url.'"/>';
});
Can this work when it’s used in the Code Snippets plugin? I want to check with you if it’s okay to use because I don’t want to mess anything on my site.
Thanks!