php – Featured Images and Google LCP

Question

I’m seeing a very interesting development with the_post_thumbnail() now that Google has added the page experience to the Google search console, now you can see page experience and I have 51 pages fail LCP because of

<?php if (has_post_thumbnail( $post->ID ) ): ?>
  <?php $image_alt = get_post_meta( '_wp_attachment_image_alt', TRUE);?>
    <div id="post-img-header">
      <?php the_post_thumbnail( 'post-header'); ?>
     </div>
 <?php endif; ?>

Using the_post_thumbnail even though this image is optimized is seeing a 20 page-speed point decrease in both page-speed and lighthouse. If i swap this image out for a normal tag i do not see this issue.

I have added an image CDN and now deliver the_post_thumbnail as WebP but this still does not make the same difference that removing post thumb and adding in a normal image tag does.

enter image description here

it’s not even like these are huge images in dimensions or even file size (72.7 KB)

and it is only happening to pages that use the_post_thumbnail which is really just our blog all other pages are using ACF images that do not see an LCP fail issue.

0
Brad Holmes 2 weeks 2021-04-28T11:40:54-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse