=== Easy Optimizer – Cache, Unused CSS, Delay JS, Lazy Load & PageSpeed Optimization ===
Contributors: easywpstuff
Tags: performance, cache, speed, lazy load, pagespeed
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.0.2
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Speed up WordPress with page cache, remove unused CSS, delay JavaScript, lazy load, LCP preload, font optimization and 20+ more features. Improve Core Web Vitals and PageSpeed scores.

== Description ==

Easy Optimizer is a free, all-in-one WordPress speed optimization plugin. It combines page caching, unused CSS removal, JavaScript delay, lazy loading, LCP preload, font optimization, database cleanup and more in a single lightweight plugin.

Every optimization targets a specific PageSpeed Insights recommendation so you can improve your Core Web Vitals scores — LCP, CLS and INP — without touching code or paying for premium plugins.

**Why site owners choose Easy Optimizer:**

**Page Cache** — Generate static HTML and serve pages in under 1ms. Supports Apache .htaccess and PHP fallback. Separate mobile and desktop caches. Automatic cache preloading via sitemap. Built-in browser caching and Gzip compression.

**Remove Unused CSS** — Analyze each page, strip CSS rules that aren't used, and inline only what's needed. Original stylesheets are deferred automatically. Directly addresses the "Reduce unused CSS" audit in PageSpeed Insights.

**Delay JavaScript** — Postpone JS execution until a visitor interacts with the page (mouse, keyboard, touch, scroll). Reduces Total Blocking Time and improves INP scores. Configurable exclusions keep critical scripts working.

**Lazy Load Images, Videos & Iframes** — Defer loading of offscreen media. Supports WebP, AVIF and SVG. Automatically skips above-the-fold images. Adds missing width and height attributes to prevent layout shifts.

**LCP Preload** — Automatically detect and preload the Largest Contentful Paint image on every page. Uses a lightweight beacon — zero configuration needed. Adds fetchpriority="high" for faster LCP.

**Instant Page Load** — Uses the Speculation Rules API to prefetch or prerender links on hover. Pages load instantly when clicked. Configurable throttle and concurrency limits.

**Font Optimization** — Adds font-display: swap to all font-face declarations including Google Fonts. Optional lazy-loading of font stylesheets.

**Image CDN** — Rewrite image URLs to ShortPixel CDN for automatic WebP/AVIF conversion and compression.

**Bloat Removal** — 15 one-click toggles to remove WordPress bloat: emojis, embeds, XML-RPC, jQuery Migrate, WP version meta, RSD/WLW links, shortlinks, RSS feeds, self-pingbacks, REST API for logged-out users, Heartbeat, WooCommerce cart fragments, Application Passwords, Dashicons for guests, and Block Library CSS.

**Database Cleanup** — Remove post revisions, auto-drafts, trashed posts, spam comments, expired transients and optimize tables. Schedule automatic cleanup. Snapshot and restore support for safe cleanup.

**Cloudflare Integration** — Automatic edge cache purge when your page cache clears. Supports tag-based and full zone purge.

**Hosting Integrations** — Auto-purges server cache on Kinsta, WP Engine, SiteGround, Cloudways, GridPane, RunCloud, SpinupWP, Rocket.net and WordPress.com.

**Accessibility Fixes** — Fix missing form labels, empty link text, button labels, viewport scaling, ARIA roles, iframe titles and tabindex issues. Improve accessibility scores alongside performance.

**SEO Fixes** — Make all links crawlable and auto-generate missing image alt attributes.

= PageSpeed Insights Recommendations Addressed =

* Eliminate render-blocking resources
* Reduce unused JavaScript
* Remove unused CSS
* Ensure text remains visible during webfont load
* Defer offscreen images
* Properly size images
* Serve images in next-gen formats
* Preload Largest Contentful Paint image
* Reduce initial server response time
* Enable text compression
* Serve static assets with efficient cache policy
* Minimize main-thread work
* Image elements do not have explicit width and height

= Works With Your Setup =

* **WordPress:** 6.4+
* **PHP:** 7.4+
* **Hosting:** All hosts. Auto-integrates with Kinsta, WP Engine, SiteGround, Cloudways, GridPane, RunCloud, SpinupWP, Rocket.net, WordPress.com
* **WooCommerce:** Fully compatible. Cart, checkout and account pages excluded from cache automatically.
* **Page Builders:** Elementor, Beaver Builder, Divi, Gutenberg
* **CDN:** Cloudflare integration built in. Works with any pull CDN.

== External Services ==

This plugin optionally rewrites image URLs to ShortPixel's CDN to serve optimized images:

* Service: ShortPixel CDN (https://cdn.shortpixel.ai/)
* What it does: When "Image CDN" is enabled, image URLs are rewritten so visitors' browsers request images from ShortPixel's CDN, enabling WebP/AVIF delivery.
* What data is sent: Only the image URL. No site data or personal information is sent.
* Links: [ShortPixel Privacy Policy](https://shortpixel.com/privacy) | [ShortPixel Terms of Service](https://shortpixel.com/terms-of-service)

== Frequently Asked Questions ==

= Does Easy Optimizer work with WooCommerce? =
Yes. Cart, checkout and account pages are excluded from caching automatically. WooCommerce session cookies bypass the cache. Cart fragments can be disabled via the Bloat tab.

= Can I use this with Cloudflare? =
Yes. Enter your API token and Zone ID in the Cloudflare tab. When Easy Optimizer clears its page cache, Cloudflare's edge cache is purged automatically.

= What does Remove Unused CSS do? =
It parses each page's HTML, identifies which CSS selectors are actually used, and generates a slim stylesheet with only the needed rules. Original stylesheets are deferred so they don't block rendering.

= Will Delay JavaScript break my site? =
Most sites work perfectly. If you notice issues, add the problematic script to the exclusion list. jQuery is excluded by default.

= How does LCP Preload work? =
On the first visit, a lightweight JavaScript beacon detects the LCP image using the browser's PerformanceObserver API. Subsequent visits get a preload hint and fetchpriority="high" on the LCP image automatically.

= Does it support multisite? =
The plugin works on individual sites within a multisite network. Network-wide activation is being tested.

= Can I use this alongside other caching plugins? =
You should disable other caching plugins' cache features before enabling Easy Optimizer's page cache. The optimization features (lazy load, delay JS, unused CSS) can coexist if you only use our optimization modules.

= How do I improve my PageSpeed score? =
Enable page cache, unused CSS removal and delay JS — these three features address the most impactful PageSpeed recommendations. Then enable lazy load and LCP preload for image optimization. Most sites see significant improvements with these five features.

= Will this help my Google ranking? =
Google uses Core Web Vitals as ranking signals. Easy Optimizer directly optimizes LCP (with preload), CLS (with image dimensions and font-display: swap) and INP (with delay JS). Faster sites tend to rank better.
== Installation ==

1. Upload the plugin files to /wp-content/plugins/easy-optimizer, or install through Plugins > Add New.
2. Activate the plugin.
3. Go to Easy Optimizer in your admin menu.
4. Enable the features you need and save.

== Screenshots ==

1. Dashboard — module status overview with cache statistics and quick actions.
2. Cache settings — page cache with preload, browser caching and Gzip controls.
3. Speed optimization — Delay JS, Remove Unused CSS and Lazy Load settings.
4. Bloat removal — 15 toggles to clean up WordPress default bloat.
5. Database cleanup — clean revisions, transients and optimize tables with snapshot support.

== Privacy ==

Easy Optimizer includes optional anonymous usage tracking to help improve compatibility and the plugin experience.

Disabled by default and only enabled after explicit opt-in.

No personal data, site content, emails, IP addresses, usernames, or passwords are collected.


== Changelog ==
= 2.0.2 =

* Improved: Database Restoring feature

= 2.0.1 =

* Improved: Performance optimizations for conditional module loading

= 2.0.0 =
Major release — complete architecture rewrite with 25+ new features.

* New: Full page caching with htaccess and PHP modes
* New: Cache preloading via sitemap
* New: Remove Unused CSS with per-page-type generation
* New: Delay JavaScript until user interaction
* New: Automatic LCP detection and preload injection
* New: Instant page load via Speculation Rules API
* New: Font optimization with display:swap and lazy-load
* New: Database cleanup with scheduled runs and snapshot/restore
* New: Cloudflare integration with auto-purge
* New: 9 hosting integrations (Kinsta, WP Engine, SiteGround, Cloudways, GridPane, RunCloud, SpinupWP, Rocket.net, WordPress.com)
* New: 8 accessibility fix toggles
* New: SEO fixes for crawlable links and image alt attributes
* New: 15 bloat removal toggles
* New: React-powered admin dashboard with REST API
* New: WooCommerce, Elementor and page builder compatibility
* Improved: Single-row settings storage, conditional module loading

= 1.1 =
* Initial release. Lazy load and Image CDN via ShortPixel.

== Upgrade Notice ==

= 2.0.0 =
Major update with page caching, delay JS, unused CSS removal, LCP preload and 25+ new features. Existing settings preserved.