Infinite Uploads provides a filter that allows developers to determine whether a given URL has been offloaded to Infinite Uploads storage. This is especially useful for plugins that need to know if media is being served locally or from the Infinite Uploads cloud—such as image optimization plugins like ShortPixel.
The filter infinite_uploads_check_offloaded receives a file URL and returns a boolean value indicating whether Infinite Uploads considers that URL “offloaded.”
Usage
You can use this filter anywhere in WordPress where you have access to a media URL. Simply call the filter with apply_filters() and pass the URL you want to check.
$is_offloaded = apply_filters( 'infinite_uploads_check_offloaded', $url );
if ( $is_offloaded ) {
// The file is offloaded to Infinite Uploads.
} else {
// The file is stored locally.
}
Parameters
| Parameter | Type | Description |
|---|---|---|
$url | string | The full URL of the file you want to check. |
Return Value
| Type | Description |
|---|---|
bool | true if the file is offloaded to Infinite Uploads; false if the file is local or not recognized. |
Example: Logging Offload Status for Debugging
$url = wp_get_attachment_url( 123 );
$is_offloaded = apply_filters( 'infinite_uploads_check_offloaded', $url );
error_log(
sprintf(
'File %s is %s',
$url,
$is_offloaded ? 'offloaded' : 'local'
)
);
When to Use This Filter
Use iinfinite_uploads_check_offloaded whenever your plugin or integration needs to:
- Detect whether a media asset is stored in Infinite Uploads cloud storage
- Adjust UI or processing logic based on storage location
- Prevent duplicate optimization, syncing, or transformation of already-offloaded media
- Integrate deeply with Infinite Uploads’ file management system
This hook is part of the latest integration improvements built for compatibility with ShortPixel and other optimization tools.