-
John1234
Hi guys – I’m getting fine page scores but the LCP is high for both mobile and desktop. Any ideas why? For a long time it was fine, but now it suddenly has increased and I cannot figure it out.
Thanks.
-
Fernando
Hi there,
PSI shows that a chunk of the cause is a high TTFB(Time To First Byte). Since your images are preloaded, and your resources are already optimized with WP Rocket, one possible reason for this issue is your Server.
If you’re not using a CDN yet, could you try using one to test? This article may be insightful: https://www.wpbeginner.com/showcase/best-wordpress-cdn-services/
-
John1234
Hi Fernando, thanks for the reply. I have a really fast cloud server setup, not shared hosting, and use a CDN. If you have any other ideas, please let me know. Thanks 🙂
-
Hi there,
for the lazy loading, thats correct you should skip any lazy loading for images that are above the fold.
I ran a few pagespeed tests on the links you provided, and the results across the tests are somewhat inconsistent, in some instances Google failed to provide any real diagnostics as to the failing FCP times.
Running performance tests in the browser, i have to really throttle network and CPU to exaggerate any issues. And the main one i see is a TTFB and Load Time delay on things such as the LCP image.
As there is very little else to go on – I would have a chat with the CDN Provider to see if they can run some diagnostics on TTFB times.
-
John1234
I seemed to have figured it out by getting the CDN to do a better job. My only question is preloading images. I preloaded the image on the single posts page using this:
https://generatepress.com/forums/topic/image-optimization-on-mobile-lcp/#post-1682167
It’s working, however for some reason GPSpeed still says to preload the image even though I can verify that it is preloaded in the header.
But, on the homepage I can’t seem to get it working for the hero element. Was trying something like this:
add_action( ‘wp_head’, function(){
if ( is_front_page()) {
$featured_img_url = get_the_post_thumbnail_url(get_the_ID(),’full’);
echo ‘<link rel=”preload” as=”image” href=”‘.$featured_img_url.'”/>’;
}
});add_filter( ‘generate_hero_thumbnail_id_size’, function() {
return ‘large’;
} ); -
I don’t see the featured image being preloaded on your homepage.
As your code doesn’t have the format, I can not tell if there’s any error.
Just make sure it’s the same as the below code:
add_action( 'wp_head', function() { if ( is_front_page() ) { $featured_img_url = get_the_post_thumbnail_url( get_the_ID(), 'full' ); echo '<link rel="preload" as="image" href="' . $featured_img_url . '"/>'; } });
And is the page hero image the featured image of the home page?
-
John1234
Awe you solved it for me. I didn’t set the featured image. Now that it’s set the code can grab it and preload it for the hero image. Thanks!
-
You are welcome 🙂
- You must be logged in to reply to this topic.