Modern image preloading/prefetching plugin for WordPress to improve page loading performance.
- Multiple Preloading Methods: JavaScript preloading, Link preload headers, or both
- Modern JavaScript: Promise-based loading with proper error handling and concurrency control
- Performance Optimized: Uses
requestIdleCallbackwhen available for optimal timing - Conditional Loading: Load on specific page types, exclude specific pages by ID
- Admin Interface: Clean, modern settings page integrated with WordPress admin
- Security Focused: Proper input sanitization and output escaping
- Localization Ready: Translation-ready with proper text domains
- Backward Compatible: Automatic migration from old plugin versions
- WordPress: 5.0+
- PHP: 7.2+
- MySQL: 5.6+
- Download and extract the plugin files
- Upload the
image-preloadingfolder towp-content/plugins/ - Activate the plugin through WordPress admin → Plugins
- Go to Settings → Image Preloading to configure options
- Add image URLs to preload in the settings page
- After activation, go to Settings → Image Preloading
- Choose your preloading method (JavaScript, Link Preload, or Both)
- Add image URLs (one per line) in the text area
- Configure additional options as needed
- Save settings
- Uses modern JavaScript with Promise-based image loading
- Compatible with all browsers
- Includes error handling and performance optimizations
- Respects browser concurrency limits
- Uses HTML
<link rel="preload">tags in the document<head> - Better performance in modern browsers
- Falls back gracefully in older browsers
- Check page source to verify
<link rel="preload">tags are present
- Combines both approaches for maximum compatibility and performance
- Recommended for most sites
- Enable Image Preloading: Toggle the entire functionality on/off
- Preloading Method: Choose JavaScript, Link Preload, or Both
- Image URLs: Enter all URLs you want to preload (one per line)
- Load on: Choose where to load preloading scripts
- All pages (default)
- Front page (static page or posts page)
- Blog posts page (when using static front page)
- Single posts only
- Pages only
- Archive pages only
- Exclude Pages: Comma-separated list of page/post IDs to exclude
- Useful for excluding heavy pages or specific landing pages
Located in Settings → Image Preloading:
The settings page includes quick access buttons to the WordPress.org plugin page and GitHub repository for support and updates.
- Enable/Disable: Global toggle for the plugin
- Preloading Method: Choose JavaScript, Link Preload, or Both
- Image URLs: Add one URL per line (supports external domains)
- Conditional Loading: Choose page types to load on
- Page Exclusion: Exclude specific page/post IDs
https://example.com/image1.jpg
https://example.com/image2.png
https://cdn.example.com/hero-banner.webp
1, 5, 12, 25
- Check URLs: Ensure all URLs are valid and accessible
- Browser Console: Check for JavaScript errors in browser developer tools
- Network Tab: Verify preload requests are being made
- CORS Issues: External domains may need CORS headers
- Link Preload Method: View page source (Ctrl+U) to verify
<link rel="preload">tags are present in<head>section - Method Selection: Ensure correct preloading method is selected in settings
- Use Conditional Loading: Only load on specific pages where needed
- Check Image Sizes: Large images impact performance
- Browser Limits: Modern browsers limit concurrent requests (plugin optimizes automatically)
- Monitor Console: Check browser console for loading status and any errors
The plugin provides console logging for troubleshooting:
- Check Browser Console: Open browser developer tools (F12)
- Look for "[Image Preloading]" messages: These show preload status and any errors
- Verify Method: Console will show which preloading method is being used
- Monitor Progress: See successful/failed image loads with URLs
- Permissions: Ensure you have proper admin permissions
- Cache: Clear any caching plugins
- JavaScript: Ensure JavaScript is enabled in your browser
If upgrading from version 1.x:
- Settings should migrate automatically
- Check admin notices for migration confirmation
- Old settings format will be cleaned up automatically
Clean object-oriented architecture with proper separation of concerns:
image-preloading.php # Main plugin file with class definitions
├── Image_Preloading_Plugin # Main plugin class (singleton pattern)
│ ├── __construct() # Hook registration and initialization
│ ├── load_options() # Settings loading with migration
│ ├── add_admin_menu() # Admin menu registration
│ ├── register_settings() # Settings API integration
│ ├── sanitize_options() # Input validation and sanitization
│ ├── enqueue_scripts() # Frontend asset loading
│ └── should_load_scripts() # Conditional loading logic
├── assets/
│ └── js/
│ └── image-preloading.js # Modern JavaScript preloader
├── languages/ # Translation files
└── README.md # This documentation
Image_Preloading_Plugin- Main plugin controller with singleton pattern- Modern JavaScript preloader with Promise-based loading
- Settings API integration with proper validation
- Text domain:
image-preloading - Translation files:
languages/directory - Fully translatable admin interface and frontend output
Licensed under the GNU General Public License v2.0 or later.
Copyright (C) 2025 snowbedding
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Made with ❤️ for the WordPress community