---
title: LCP Optimization
description: Speed up Largest Contentful Paint in WordPress with Powered Cache Premium. Learn how the LCP image is detected, preloaded and prioritized, and how to check it.
url: "https://poweredcache.com/docs/lcp-optimization/"
updated: "2026-12-02"
category: Preloading
---

# LCP Optimization

LCP Optimization finds the image that is most likely to be the largest element at the top of each page and tells the browser to download it first. It also preloads the first fonts declared in the page. This improves Largest Contentful Paint (LCP), the Core Web Vital that measures how quickly the main content of a page appears.

**Available in:** Powered Cache Premium
**Where to find it:** Powered Cache → Preload, in the *Critical resources* group

## How LCP Optimization works

When WordPress has built a page, and before it is sent and cached, Powered Cache Premium makes three passes over the HTML.

### 1. Find and preload the LCP image

Powered Cache picks one image, checking in this order:

1. The first `<picture>` element inside `<main>`, then inside `<article>`, then inside the first `<section>`, then anywhere on the page.
2. Otherwise, the first image inside `<main>`, then inside `<article>`, then inside a `<div>` element whose class contains `hero` or `banner`, then inside the first `<section>`, and finally the first image on the page.
3. Otherwise, the poster image of the first video.

If the image has been replaced by a lazy-load placeholder, the real address is read from `data-src`, `data-lazy-src` or `data-original`. Powered Cache then adds a `<link rel="preload" as="image" fetchpriority="high">` tag to the `<head>`, including the responsive `srcset` and `sizes` when the image has them, and adds `fetchpriority="high"` and `loading="eager"` to the image tag itself. If the page already preloads that image, nothing is added.

### 2. Preload critical fonts

Powered Cache looks for `@font-face` rules in the page's inline `<style>` blocks and preloads the first two WOFF2 or WOFF files it finds. Fonts that are only declared in external CSS files are not detected. Add those to [Preload Fonts](/docs/resource-hints/#preload-fonts) instead.

> **Changed in 4.0:** Font preloading is on by default whenever LCP Optimization is on. Image prioritization was also made safer and more reliable.

### 3. Prioritize the theme stylesheet

When [Critical CSS](/docs/critical-css/) is on, the theme's `style.css` link gets `fetchpriority="high"`, so the browser loads it ahead of less important files.

## Turn on LCP Optimization

1. Go to **Powered Cache → Preload**.
2. Turn on **LCP Optimization**. **Default: off.** With an active license, **Apply Recommended Settings** turns it on.
3. Click **Save Settings** and clear the cache, so cached pages are rebuilt.
4. [Check the result](#verify) on your most important templates: home page, a post, a page and, for shops, a product.

## Check which image was chosen

1. Open the page in a private browser window and view the page source.
2. Search for `LCP Optimization`. You find the comment `<!-- LCP Optimization: Image Preload by Powered Cache Premium -->` followed by the preload tag, and a similar comment for each preloaded font.
3. Run PageSpeed Insights and compare the LCP element it reports with the preloaded image. They should be the same.

## When LCP Optimization does not run

The page is left unchanged in the admin area, for REST API requests, previews, `robots.txt` and trackbacks, for requests other than `GET`, and for responses that are not a full HTML page.

## Things to know

- **Detection is a best guess.** It reads the HTML, not the rendered page, so it cannot see CSS background images or know what is visible on a phone. If your theme has no `<main>` or `<article>` element, the first image on the page, often the logo, can be chosen.
- **Lazy loading:** the preload downloads the image early, but an image that is still lazy loaded waits for the lazy-load script before it is shown. Exclude your hero image from [Lazy Load](/docs/lazy-load/) or keep [Skip First Images](/docs/lazy-load/#skip-first-images) above zero.
- **One image per page.** Sliders and galleries at the top of the page may need the first slide to be the image you want to prioritize.

## Troubleshooting

### The wrong image is preloaded

Preloading the wrong image takes bandwidth away from the real LCP element. If your theme does not use `<main>`, `<article>` or a `<div>` with a `hero` or `banner` class around the main image, ask a developer to choose the image with the `powered_cache_lcp_image` filter (see below), or turn LCP Optimization off. The setting is site-wide, so turning it off affects every page. To skip only the affected pages, a developer can use the `powered_cache_skip_lcp_optimization` filter. It runs at `after_setup_theme`, so conditional tags such as `is_page()` are not available yet. Check the request path instead (see below).

### No preload tag appears

- Clear the cache. Pages cached before you turned the feature on do not have the tag.
- The page may have no image or video poster in the HTML, for example when the hero is a CSS background image.
- The theme or another plugin may already preload the image. Then Powered Cache does not add a second tag.

## For developers

Useful filters:

- `powered_cache_lcp_image`: replace the detected image. Return an array with `url`, `srcset`, `sizes` and `type`.
- `powered_cache_skip_lcp_optimization`: return `true` to skip a request.
- `powered_cache_lcp_preload_attributes`: change the attributes of the image preload tag.
- `powered_cache_lcp_preconnect_domains`: add origins for preconnect hints.
- `powered_cache_enable_lcp_font_preload`, `powered_cache_lcp_max_fonts_to_preload` (default 2), `powered_cache_lcp_font_urls` and `powered_cache_lcp_font_preload_attributes`: control font preloading.
- `powered_cache_enable_lcp_css_optimization` and `powered_cache_lcp_priority_css_patterns`: control which stylesheets get high priority.

The skip filter runs early, before WordPress knows which page is requested, so conditional tags such as `is_page()` do not work there. Check the request path instead:

```
add_filter( 'powered_cache_skip_lcp_optimization', function ( $skip ) {
	$path = wp_parse_url( $_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH );

	return '/landing-page/' === $path ? true : $skip;
} );
```

See the [Hooks Reference](/docs/hooks-reference/) for all parameters.

## Related docs

- [Lazy Load](/docs/lazy-load/)
- [Resource Hints](/docs/resource-hints/): preload fonts and preconnect to other servers.
- [Critical CSS](/docs/critical-css/) (Premium)
- [Image Optimization](/docs/image-optimization/) (Premium)
