=== AttiaWebP - Safe WebP Replace & Optimizer ===
Contributors: ahmedattia15
Tags: webp, images, optimization, media, performance
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A local-only WebP sidecar conversion, upload-file statistics, and optional server-level WebP delivery workflow for WordPress media libraries.

== Description ==

AttiaWebP helps site owners convert JPEG and PNG media library images into WebP using the image tools available on their own WordPress server.

The default mode is conservative: it creates WebP copies next to the original files and keeps the original JPEG/PNG files untouched. Optional server-level WebP delivery can serve matching WebP sidecar files without rewriting front-end HTML, WooCommerce product markup, widgets, or content.

Advanced replacement tools are included for site owners who want a one-image WebP media library. These tools are disabled by default and require explicit confirmation before deleting original JPEG/PNG files or generated image sizes.

Main features:

* Automatically create WebP files after new JPEG/PNG uploads.
* Bulk convert existing media library images in safe batches.
* Cursor-based bulk processing designed for large media libraries.
* Upload-file statistics for JPEG/PNG, WebP, WebP sidecar conversions, and AVIF files.
* Optional server-level WebP delivery through a managed uploads `.htaccess` rules block on Apache/LiteSpeed servers.
* Optional single image mode for future uploads.
* Optional permanent replacement mode that updates media items to WebP and deletes old JPEG/PNG files after explicit confirmation.
* Quality control, defaulting to 82.
* Option to skip generated WebP files when they are larger than the source file.
* No external API calls and no third-party tracking.

Important: Always create a full backup before using permanent replacement tools. Replacement mode deletes original JPEG/PNG files and generated image sizes after successful WebP conversion.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install the ZIP through Plugins > Add New > Upload Plugin.
2. Activate the plugin through the Plugins screen in WordPress.
3. Open Settings > AttiaWebP WebP Optimizer.
4. Review the settings and save your preferred configuration.
5. Use the safe bulk conversion tool to create WebP copies for existing media.

== Frequently Asked Questions ==

= Does this plugin delete my original images by default? =

No. By default, the plugin creates WebP copies and leaves JPEG/PNG originals untouched.

= Can it replace originals with WebP? =

Yes, but only through advanced options. Permanent replacement is disabled by default and requires a confirmation checkbox plus the exact text DELETE ORIGINALS before bulk replacement can run.

= What does quality 82 mean? =

It is the WebP compression quality value. Lower values create smaller files with more visible compression. Higher values preserve more detail but create larger files. The default value of 82 is a balanced starting point.

= Does it use an external service? =

No. Conversion uses the image editor available on the WordPress server, such as GD or Imagick with WebP support.

= Will this work on every host? =

The server must support WebP through GD or Imagick. The settings screen shows a basic support check.

= Does server WebP delivery work on Nginx? =

The built-in server delivery option manages an uploads `.htaccess` block, which is for Apache/LiteSpeed environments. On Nginx, use safe sidecar conversion or ask your host for equivalent Nginx rules.

= Does server WebP delivery change my WooCommerce product HTML? =

No. Server WebP delivery does not rewrite product HTML, image src attributes, srcset values, content, widgets, or custom CSS. It only lets the server return a matching WebP file for JPEG/PNG requests when the browser supports WebP and a matching WebP file exists.

= Should I use permanent replacement on a live store? =

Only after testing on staging and creating backups. Some themes, builders, or stores may rely on generated image sizes.

== Privacy ==

AttiaWebP does not send images, site data, or usage data to external services. All conversion work happens locally on the WordPress server.

== Changelog ==

= 1.1.1 =
* Hardened server-delivery rule management and avoided creating an empty uploads `.htaccess` file when delivery is disabled.
* Added admin notices when server-delivery rules cannot be written.
* Reworked bulk processing to use cursor-based batches instead of loading every attachment ID into memory.
* Added cached upload-file statistics with a manual refresh link.
* Disabled bulk buttons when WebP support is not available on the server.
* Refreshed the translation template and WordPress.org package metadata.

= 1.1.0 =
* Added optional server-level WebP delivery using managed uploads `.htaccess` rules.
* Kept front-end HTML rewriting disabled to avoid theme, WooCommerce, WPML, and cache-plugin conflicts.

= 1.0.1 =
* Safe store build: disabled front-end URL rewriting and added real upload-file statistics.

= 1.0.0 =
* Initial public release.
