Install the TrueSmush plugin and every image you upload gets compressed automatically โ your site loads faster, Core Web Vitals stop screaming, and your originals stay safe.
v0.1 beta ยท PHP 7.4+ ยท Tested with WordPress 6.x ยท Source on GitHub
Every image you upload to the Media Library is compressed automatically โ original and all thumbnails.
The plugin never makes things worse: if the compressed copy is bigger, the original stays untouched.
Keep the original format (safe default) or convert to WebP / AVIF from the settings page.
Media โ Tinypixel page: compress the whole library in batches of 5, with per-file reports.
Paste your TrueSmush API key in settings. Compression runs on our engine, not your server.
Nonces + capability checks on every request. Never deletes files, ever.
Grab the zip below (v0.1 beta). No dependencies beyond a standard WordPress + PHP 7.4+.
WP Admin โ Plugins โ Add New โ Upload Plugin โ choose the zip โ Activate.
Settings โ Tinypixel โ enter your key, pick a default format and quality.
New uploads are handled automatically. For existing media, use Media โ Tinypixel โ Compress all.
Need an API key? Grab one here โ during beta the API is free.
The plugin hooks wp_generate_attachment_metadata so compression is part of the upload pipeline โ nothing runs on page load.
add_action('wp_generate_attachment_metadata', function ($metadata, $attachment_id) {
// compress original + every thumbnail via the TrueSmush API
foreach (image_paths_for($metadata, $attachment_id) as $path) {
$result = TrueSmush_compress($path); // returns smaller copy only
if ($result['smaller']) file_put_contents($path, $result['bytes']);
}
return $metadata;
}, 10, 2);