Troubleshooting Slow AMP Pages and High LCP Scores
Content
Many WordPress users implementing the official AMP plugin report a common issue: their AMP pages, particularly on mobile, suffer from slow loading times and poor Largest Contentful Paint (LCP) scores in tools like Google PageSpeed Insights. This is often confusing because their non-AMP mobile pages perform significantly better. This guide will explain why this happens and walk you through the most effective solutions.
Why Are My AMP Pages Slow?
The AMP plugin performs extensive server-side processing to generate optimized pages. Without proper caching, this extra processing can result in a high Time to First Byte (TTFB), which directly delays the LCP. The core issue is almost always related to how your server and caching configuration handle AMP-specific requests.
Common Solutions to Improve AMP Performance
1. Implement and Verify Proper Page Caching
This is the most critical step. The AMP plugin frequently shows a "Page caching is not detected" warning in Site Health, even when a caching plugin is active. This happens because the plugin's detection mechanism looks for specific HTTP client caching headers (like cache-control, age, or x-cache) in the response for AMP pages.
How to fix it:
- Check Caching Plugin Configuration: Ensure your caching plugin (e.g., LiteSpeed Cache, WP Rocket, FlyingPress) is correctly configured to cache AMP pages. Some users found that FlyingPress reported a
MISSfor AMP pages, meaning they were not being cached. - Verify Headers: Use your browser's developer tools (Network tab) to inspect the HTTP headers for an AMP page (often ending in
?amp=1or/amp/). Confirm that caching headers are present. If they are missing, you may need to adjust your caching plugin's settings or consult its documentation for AMP-specific rules. - Server-Level Caching: If you use a service like Cloudflare, ensure your page rules are configured to also cache AMP URLs.
2. Optimize Your Largest Contentful Paint (LCP) Element
Even with caching, a slow-loading hero image can ruin your LCP score. The AMP plugin has specific features to help with this.
How to fix it:
- Use the
data-heroAttribute: For your LCP image (usually a post's featured image), ensure it is marked with thedata-heroattribute. This tells the AMP plugin to prioritize this image during server-side rendering. - Enable Native Images: In the AMP plugin settings, consider enabling the "Use native img tag" option. The
amp-imgcomponent is largely obsolete now that browsers support lazy-loading natively, and using standardimgtags can improve performance. - Preload Critical Images: For standard WordPress images, you can add code to your theme's
functions.phpfile to preload featured images, which can help the browser discover them faster.
3. Address Font Display Issues
PageSpeed might warn about being unable to check the font-display value. To prevent render-blocking, ensure your fonts are using an optimal font-display policy.
How to fix it:
- Locate your
@font-faceCSS rules and change the propertyfont-display: swap;tofont-display: optional;orfont-display: block;to reduce layout shifts and improve perceived performance.
4. Optimize Server Response Time
A slow server response time (TTFB) is a major bottleneck. The AMP plugin recommends a server response time of under 600 milliseconds.
How to fix it:
- Investigate Server Resources: A high TTFB often indicates a server-side issue. Contact your hosting provider to check if your server resources (CPU, memory) are sufficient for your traffic.
- Audit Plugins: Poorly coded plugins can significantly slow down your site. Use monitoring tools to identify any plugins that are consuming excessive server resources on AMP pages.
5. Ignore Obsolete Warnings
Some warnings, like "Preload AMP runtime," are now considered obsolete by the AMP team and can be safely ignored. Adding code to preload it is no longer necessary for performance and may not help your scores.
Conclusion
Improving AMP performance is primarily a two-step process: ensuring your pages are being served from a robust cache and optimizing the specific elements that contribute to the LCP metric. By systematically verifying your caching setup and implementing image and font optimizations, you should see a significant improvement in your AMP page speed scores.
Related Support Threads Support
-
Facing LCP issues on our AMP and non AMP mobile pageshttps://wordpress.org/support/topic/facing-lcp-issues-on-our-amp-and-non-amp-mobile-pages/
-
Lighthouse was unable to automatically check the `font-display` valuehttps://wordpress.org/support/topic/lighthouse-was-unable-to-automatically-check-the-font-display-value/
-
Page caching is not detected and the server response time is slowhttps://wordpress.org/support/topic/page-caching-is-not-detected-and-the-server-response-time-is-slow/
-
Page caching is not detected but the server response time is OKhttps://wordpress.org/support/topic/page-caching-is-not-detected-but-the-server-response-time-is-ok/
-
LCP, Preload Largest Contentful Paint imagehttps://wordpress.org/support/topic/lcp-preload-largest-contentful-paint-image/
-
LCP 73.1 sechttps://wordpress.org/support/topic/lcp-73-1-sec/
-
Bad LCPhttps://wordpress.org/support/topic/bad-lcp/
-
Help with AMP and LCPhttps://wordpress.org/support/topic/help-with-amp-and-lcp/
-
Big drop in page speed after WordPress 5.9 Updatehttps://wordpress.org/support/topic/big-drop-in-page-speed-after-wordpress-5-9-update/
-
Preload AMP runtimehttps://wordpress.org/support/topic/preload-amp-runtime-2/
-
Page caching not detectedhttps://wordpress.org/support/topic/page-caching-not-detected-3/
-
Preload Largest Contentful Imagehttps://wordpress.org/support/topic/preload-largest-contentful-image/
-
AMP standard mode with Cachehttps://wordpress.org/support/topic/amp-standard-mode-with-cache/
-
Pagespeedhttps://wordpress.org/support/topic/pagespeed-12/
-
Page caching is not detectedhttps://wordpress.org/support/topic/page-caching-is-not-detected/
-
How to fix AMP LCPhttps://wordpress.org/support/topic/how-to-fix-amp-lcp/
-
The AMP plugin performs at its best when page caching is enabled.https://wordpress.org/support/topic/the-amp-plugin-performs-at-its-best-when-page-caching-is-enabled/
-
HIgh LCP and more using legacy modehttps://wordpress.org/support/topic/high-lcp-and-more-using-legacy-mode/
-
Shortened links from social media take a long time to loadhttps://wordpress.org/support/topic/shortened-links-from-social-media-take-a-long-time-to-load-2/
-
Cdnhttps://wordpress.org/support/topic/cdn-38/
-
Page caching is not detectedhttps://wordpress.org/support/topic/page-caching-is-not-detected-2/
-
Amp cache errorhttps://wordpress.org/support/topic/amp-cache-error/
-
AMP page caching detectedhttps://wordpress.org/support/topic/amp-page-caching-detected/
-
CLS FCS problem on amp pageshttps://wordpress.org/support/topic/cls-fcs-problem-on-amp-pages/
-
Web Stories, LCP and preload imageshttps://wordpress.org/support/topic/web-stories-lcp-and-preload-images/
-
AMP Plugin Not Improving Core Web Vitals Scoreshttps://wordpress.org/support/topic/amp-plugin-not-improving-core-web-vitals-scores/
-
Reduce unused JavaScript 0.75 shttps://wordpress.org/support/topic/reduce-unused-javascript-0-75-s/