ShortPixel
ShortPixel Image Optimizer compresses and converts images to WebP and AVIF format. WP Media Cloud and ShortPixel work together without conflict. WP Media Cloud offloads files to cloud storage and ShortPixel handles compression — the two pipelines run independently and hand off to each other automatically.
How they work together#
The integration works differently depending on whether local file removal is enabled.
With local files present
When a file is uploaded, WP Media Cloud offloads it to cloud storage immediately. ShortPixel then reads the local file using WordPress’s standard file path, compresses it, and saves the optimized version locally. WP Media Cloud detects the updated file and re-offloads the optimized version to cloud storage, replacing the original. The final file in your bucket is the compressed version.
With local file removal enabled
When local files have been removed after offloading, ShortPixel uses its virtual file system. It downloads the file from the CDN URL (which WP Media Cloud provides via wp_get_attachment_url()), optimizes it in memory, and writes the result back. WP Media Cloud then re-offloads the optimized version to cloud storage.
WebP and AVIF delivery
ShortPixel wraps image tags in <picture> elements with WebP and AVIF sources. WP Media Cloud rewrites the URLs inside those picture elements to CDN URLs automatically as part of its content URL rewriting. No additional configuration is needed.
Configuration#
No configuration is required in either plugin to make them work together. WP Media Cloud detects ShortPixel automatically and reports its status on the Integrations tab in the plugin dashboard.
The only setting worth considering is ShortPixel’s compression mode. ShortPixel offers synchronous and asynchronous (background queue) modes:
- Synchronous mode — compression runs during the upload request. The file in cloud storage is the compressed version from the first offload. The media library shows the correct compressed file size immediately after upload.
- Asynchronous mode — compression runs in the background after the upload completes. WP Media Cloud offloads the original uncompressed file first, then re-offloads the compressed version once ShortPixel finishes. During the window between upload and background compression completing, the uncompressed file is live in your bucket. The file size shown in the media library reflects the original until the background job completes.
Both modes produce the correct final result. Synchronous mode makes uploads feel slower. Asynchronous mode is faster on upload but means the uncompressed file is briefly live in cloud storage.
Bulk optimization after migration#
If you run the WP Media Cloud bulk migration tool to offload your existing media library and then want to compress those files with ShortPixel, run ShortPixel’s bulk optimization tool after the migration completes. ShortPixel will compress each file and WP Media Cloud will re-offload the compressed version to cloud storage automatically.
Troubleshooting#
ShortPixel is not compressing offloaded files
ShortPixel needs to be able to either read the local file or download the file from the CDN URL. If local files have been removed and ShortPixel cannot reach the CDN URL (for example because the bucket is private or the CDN hostname is not resolving), compression will fail silently. Confirm the file URL is publicly accessible.
File size shown in media library is the original uncompressed size
ShortPixel is running in asynchronous mode. The size shown immediately after upload reflects the original file. Once the background compression job completes, the compressed version is re-offloaded and the size will update when you reload the media library.
WebP or AVIF URLs in page source are pointing to the local server
WP Media Cloud rewrites WebP and AVIF source URLs that ShortPixel inserts into <picture> elements. If these are not being rewritten, confirm that Rewrite URLs is enabled in WP Media Cloud > Settings.