Skip to content

Measured image priority

Shane Rounce edited this page Dec 1, 2026 · 1 revision

Measure the image that determines Largest Contentful Paint

If a public page loads its main image late, a theme developer can measure which image determines Largest Contentful Paint (LCP) on both mobile and desktop. ARC 0.14.0 can then give that image high fetch priority when filling its guest page cache. WordPress, Lens and the browser keep choosing the responsive file.

Measure a staging page

Use the ARC source checkout on a build machine with Node.js, Playwright and Chromium. Point the tool at a public HTTPS URL on staging. Use the final URL after any redirects, with no query string.

node bin/measure-lcp-image.cjs https://staging.example.org/events/ ./candidate-profiles > before.json

The tool opens six fresh Chromium contexts, three at each width. The report contains the LCP element, elapsed milliseconds, image URL and request count for each visit. A non-null profile means the same image element qualified in all six visits. One responsive element can use different source files on mobile and desktop.

Three views of a measured Chromium report showing a preloaded hero fetched once per visit

The animation uses the six recorded visits to William Unicycle. The existing hero had high priority, was preloaded and downloaded once per visit. The report returned profile: null. A text LCP, different winning elements or competing image priorities can also leave the profile empty.

Trial a qualifying profile

  1. Copy the generated JSON file, with its generated filename, into the active staging theme’s arc-lcp-images/ directory. The profile is specific to the measured HTTPS host and path.

  2. Register theme support during after_setup_theme.

    add_action( 'after_setup_theme', static function () {
        add_theme_support( 'aceredis-measured-lcp' );
    } );
  3. Purge that page and request it as a guest. Inspect the served HTML for fetchpriority="high" on the measured image. ARC changes native lazy loading to eager when appropriate and preserves the responsive sources.

  4. Run the command again without the output directory, redirecting the report to after.json. Compare median LCP at each width and check the intended image downloaded once in every sample. Repeat the comparison before adopting the profile.

ARC accepts profiles up to seven days old. Rebuild after a theme, image or layout change. To withdraw a trial, remove its profile and purge that page’s cached HTML.

What the trials showed

A synthetic responsive hero improved in the browser fixture. The three public homepages we measured showed why each theme needs its own evidence. William Unicycle already prioritised the right hero. Sheffield Events had a heading as its mobile LCP and a map tile on desktop. On Uni-Carts we compared the existing priorities with a browser-only change to the cover and seven gallery images. In 20 cold visits the cover downloaded once each time. Median mobile LCP went from 440 to 460 ms and desktop from 496 to 528 ms. The site kept its existing priorities. Measurements and trial results

Clone this wiki locally