Chad
Chad

Reputation: 1

How to ensure the image in this container is preloaded to reduce LCP

This resource which sits inside a container and updates with the latest post/image every time a new one is posted - is dragging down my LCP on pagespeedinsights.

I have added this code to functions.php but nothing changes.

`function wpp_preloadimages() {
  echo '
  <link rel="preload" as="image" href="https://chad-wyatt.com/wp-content/uploads/2025/01/SEO-tools-696x398.webp" />
  ';
}
add_action( 'wp_head', 'wpp_preloadimages' );`

I tried plugins with lines of code and exhausted all my technical knowledge trying to figure this out. I looked at the page source and the preload tag is there and does exist, cache was cleared, still the exact same issues being flagged.

Am I missing something? Does anyone know what is causing this?

Here is the issue from pagespeedinsights:

enter image description here

div.td-image-container > div.td-module-thumb > a.td-image-wrap > span.entry-thumb
<span class="entry-thumb td-thumb-css td-animation-stack-type0-2" data-type="css_image" data-img-url="https://chad-wyatt.com/wp-content/uploads/2025/01/SEO-tools-696x398.webp" style="background-image: url(&quot;https://chad-wyatt.com/wp-content/uploads/2025/01/S…&quot;);">

Thanks for the help

Code, plugins, theme file

Upvotes: 0

Views: 18

Answers (0)

Related Questions