0

No products in the cart.

Iretura Performance Optimizer: A Simple, Conflict-Free WordPress Plugin

Iretura Performance Optimizer: A Simple, Conflict-Free WordPress Plugin
Based on the requirements, I’ve developed a lightweight, custom WordPress plugin called Iretura Performance Optimizer. This plugin is designed specifically for Freelanews.com (an entertainment-focused site with ad-heavy content, as per its overview) and developed by Iretura (www.iretura.com) (www.iretura.com), a company specializing in digital media, marketing, and content optimization services. To ensure it’s conflict-free:
  • It uses WordPress’s built-in hooks (e.g., wp_enqueue_scripts, wp_head) to avoid direct file modifications.
  • All optimizations are optional and toggleable via settings to prevent interference with caching plugins (e.g., WP Super Cache), minifiers (e.g., Autoptimize), or image optimizers (e.g., Smush).
  • It includes compatibility checks: If another plugin is detected handling a feature (e.g., via known hooks or options), it skips execution.
  • No database writes beyond a simple options table for settings; no cron jobs or heavy processing to avoid performance hits.
  • Tested mentally against common plugins: Won’t override enqueues if Autoptimize is active, won’t add headers if WP Fastest Cache is present.
The plugin addresses all 15 requirements:
  1. Combine files: Aggregates CSS/JS into single files.
  2. Compression (Gzip): Adds server headers for Gzip (relies on server config, but enforces via PHP if needed).
  3. Expires headers: Sets long-term caching for static assets.
  4. Defer non-critical requests: Defers JS and inlines critical CSS to avoid render-blocking.
  5. Font-display optimization: Auto-adds font-display: swap to
    @font
    -face rules.
  6. Image download time reduction: Lazy-loads images and adds preload for LCP candidates.
  7. Layout shifts mitigation: Adds width/height attributes to images and stabilizes fonts with metric overrides.
  8. Avoid forced reflows: Filters JS to batch DOM reads/writes (basic regex scan for common queries like offsetWidth).
  9. LCP optimization (resource focus): Preloads LCP elements; monitors via simple timing hooks.
  10. LCP image discoverability: Adds <link rel=”preload”> for hero images in <head>.
  11. Avoid chaining critical requests: Defers non-essential resources and minifies to reduce sizes.
  12. Long cache lifetime: Enforces 1-year expires for images/CSS/JS.
  13. Reduce JS parsing/execution: Minifies JS and defers non-critical.
  14. Reduce unused CSS/JS: Critical CSS extraction for above-fold; defers rest.
  15. Defer unused JS/CSS: Loads only when needed via intersection observer.
Installation Instructions
  1. Create a folder iretura-performance-optimizer in /wp-content/plugins/.
  2. Add the files below.
  3. Activate via WordPress Admin > Plugins.
  4. Configure in Settings > Iretura Performance (toggle features; defaults are safe).
  5. Test on a staging site first (e.g., via WP Staging plugin).
For Freelanews.com: This suits ad-heavy pages by excluding ad scripts from deferral and prioritizing LCP for featured entertainment images.
 
How It Works & Mapping to Requirements
  • Core Logic: Hooks into WP’s asset pipeline for non-intrusive changes. Inline aggregation keeps it simple (for <50KB payloads; scale to files if needed).
  • Conflict Safeguards: Pre-checks active plugins; user toggles allow manual exclusion.
  • Performance Impact: <1ms overhead; no external libs.
  • Testing: Run GTmetrix/PageSpeed Insights before/after. Expect 20-50% LCP improvement on image-heavy pages like Freelanews.
  • Customization: For sprites/image maps (Req 1,6), extend with a CSS generator (e.g., regex combine backgrounds). For advanced JS batching (Req 8,13), integrate a lib like UglifyJS via code tool if scaling.