Preload featured images, fonts, CSS, and JavaScript to improve Largest Contentful Paint (LCP) and your Core Web Vitals (CWV) score in Google Lighthouse.
A lightweight WordPress plugin that adds resource hints (rel=preload) so the browser fetches your most important assets sooner.
- Automatic featured-image preload for posts and pages (enabled by default) using a single, consistent image size for the
href,imagesrcset, andimagesizeshints. - WooCommerce support — falls back to the first product gallery image when no featured image is set.
- Manual preloads for fonts, CSS, and JavaScript, configured from the settings screen and emitted as HTTP
Linkheaders via.htaccess. - Safe
.htaccessupdates — backs up the file, writes the change, runs a site-availability check, and restores the backup automatically if anything fails. - Multisite-aware option storage.
- Material Design 3 settings UI.
- WordPress 4.9 or later
- PHP 7.4 or later
- Apache/LiteSpeed for the
.htaccess-based font/CSS/JS preloads (the featured-image preload works on any server)
- Download the latest ZIP from the Releases page.
- In WordPress, go to Plugins → Add New → Upload Plugin and select the ZIP.
- Activate the plugin. Featured-image preloading is enabled automatically.
- Copy this directory into
wp-content/plugins/oxyplug-preload. - Activate Oxyplug Preload from the Plugins screen.
After activation, featured images are preloaded automatically on single posts and pages.
To preload fonts, CSS, or JS manually:
- Go to Tools → Oxyplug Preload.
- Add the full URLs under Script, Style, or Font.
- Click Save. The URLs are written to your site's
.htaccessas preloadLinkheaders.
By default the featured-image preload uses the post-thumbnail size. If your theme renders the
featured image at a different size, match it with the oxyplug_preload_image_size filter so the
preload points at the exact image the browser will render:
add_filter('oxyplug_preload_image_size', function () {
return 'large'; // or 'full', or any registered image size
});The settings UI uses Material Web components bundled with Vite.
npm install # install dependencies
npm run dev # start the Vite dev server
npm run build # build the component bundles into assets/js/distThe built files in
assets/js/distare committed because the plugin loads them at runtime.
oxy-preload.php Main plugin file (all PHP logic)
readme.txt WordPress.org-format readme + changelog
assets/css/ Admin styles
assets/js/src/ Material Web component entry points
assets/js/dist/ Built component bundles (loaded by the plugin)
assets/images/ Icons used in the admin UI
See readme.txt for the full changelog. Latest:
- Exclude development, test, and build files from the published plugin package to reduce its size.
- Declare a font MIME type (
type=) on font preloads to avoid a double font download in some browsers. - Add an uninstall routine and deactivation cleanup that remove the
.htaccesspreload block and plugin options. - Security: require the
manage_optionscapability in the preload save handler. - Fix featured-image preload escaping (
esc_url) and a PHP warning on servers that don't setSERVER_SOFTWARE.
- Add translations for Spanish, French, German, Italian, and Brazilian Portuguese.
- Load the plugin text domain so bundled translations are applied.
- Fix preloaded featured-image size mismatch that could cause a duplicate image download and hurt LCP.
- Fix a fatal error on the front end when checking for the Oxyplug Image plugin.
Issues and pull requests are welcome. Please open an issue to discuss substantial changes before submitting a PR.
Distributed under the GPL v2 or later license. See LICENSE for the full text.
- Plugin website: https://www.oxyplug.com/products/oxy-preload
- Documentation: https://www.oxyplug.com/docs/oxy-preload/