sandywp / plugins / image-prioritizer
Image Prioritizer
Prioritizes the loading of images and videos based on how they appear to actual visitors: adds fetchpriority, preloads, lazy-loads, and sets sizes.
Ready in seconds.
v1.0.0-beta4 40,000+ installs WP 6.9+ PHP 7.4+

About this plugin
This plugin optimizes the loading of images (and videos) with prioritization to improve Largest Contentful Paint (LCP), lazy loading, and more accurate image size selection.
The current optimizations include:
- Add breakpoint-specific
fetchpriority=highpreload links (both asLINK[rel=preload]elements andLinkresponse headers) for image URLs of LCP elements:- An
IMGelement, including thesrcset/sizesattributes supplied asimagesrcset/imagesizeson theLINK. - The first
SOURCEelement with atypeattribute in aPICTUREelement. (Art-directedPICTUREelements using media queries are not supported.) - An element with a CSS
background-imageinlinestyleattribute. - An element with a CSS
background-imageapplied with a stylesheet (when the image is from an allowed origin). - A
VIDEOelement’sposterimage.
- An
- Ensure
fetchpriority=highis only added to anIMGwhen it is the LCP element across all responsive breakpoints. - Add
fetchpriority=lowtoIMGtags which appear in the initial viewport but are not visible, such as when they are subsequent carousel slides. - Lazy loading:
- Apply lazy loading to
IMGtags based on whether they appear in any breakpoint’s initial viewport. - Implement lazy loading of CSS background images added via inline
styleattributes. - Lazy-load
VIDEOtags by setting the appropriate attributes based on whether they appear in the initial viewport. If aVIDEOis the LCP element, it getspreload=auto; if it is in an initial viewport, thepreload=metadatadefault is left; if it is not in an initial viewport, it getspreload=none. Lazy-loaded videos also get initialpreload,autoplay, andposterattributes restored when theVIDEOis going to enter the viewport.
- Apply lazy loading to
- Responsive image sizes:
- Ensure
sizes=autois set onIMGtags after setting correct lazy-loading (above). - ~~Compute the
sizesattribute using the widths of an image collected from URL Metrics for each breakpoint (when not lazy-loaded since then handled bysizes=auto).~~ (This has been removed due to an issue; use Enhanced Responsive Images instead.)
- Ensure
- Reduce the size of the
posterimage of aVIDEOfrom full size to the size appropriate for the maximum width of the video (on desktop).
This plugin requires the Optimization Detective plugin as a dependency. Please refer to that plugin for additional background on how this plugin works as well as additional developer options.
👉 Note: This plugin optimizes pages for actual visitors, and it depends on visitors to optimize pages. As such, you won’t see optimizations applied immediately after activating the plugin. Please wait for URL Metrics to be gathered for both mobile and desktop visits. And since administrator users are not normal visitors typically, optimizations are not applied for admins by default.
Your site must have the REST API accessible to unauthenticated frontend visitors since this is how metrics are collected about how a page should be optimized. There are currently no settings and no user interface for this plugin since it is designed to work without any configuration.
Questions
- Where can I submit my plugin feedback?
Feedback is encouraged and much appreciated, especially since this plugin may contain future WordPress core features. If you have suggestions or requests for new features, you can submit them as an issue in the WordPress Performance Team’s GitHub repository. If you need help with troubleshooting or have a question about the plugin, please create a new topic on our support forum.
- Where can I report security bugs?
The Performance team and WordPress community take security bugs seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
To report a security issue, please visit the WordPress HackerOne program.
- How can I contribute to the plugin?
Contributions are always welcome! Learn more about how to get involved in the Core Performance Team Handbook.
The plugin source code is located in the WordPress/performance repo on GitHub.
sandywp / also on the shelf
Try another plugin
4.9 · 200K+ installs
Automatically resizes huge image uploads. Are contributors uploading huge photos? Tired of manually resizing your images?…
4.8 · 200K+ installs
Formerly Easy Fancybox. The most popular WordPress lightbox plugin. Simple, fast, and responsive. Opens images, videos, PDFs, and…
Responsive Lightbox & Gallery
4.9 · 100K+ installs
The most popular lightbox plugin and responsive gallery builder for WordPress.
Spin up a real WordPress site in seconds.
Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.