Image Optimization

/Media Optimization/Image Optimization

Image optimization is a premium feature that allows optimizing your images instantly without using your server resources.

When this feature is enabled, the original image addresses will be replaced with our image optimization service (img.poweredcache.net). This service will perform on-the-fly image optimization, resizing, and conversion to AVIF or WebP formats, depending on what the client’s browser supports.

How to exclude Images from Image Optimizer?

You can use the powered_cache_image_optimizer_skip_image filter to control the behavior programmatically. For instance, the following snippet will exclude .svg images from being served by our image optimizer:

function exclude_svg_images_from_optimization( $skip, $src, $tag ) {
    // Check if the image URL ends with .svg
    if ( strpos( $src, '.svg' ) !== false ) {
        $skip = true;
    }
    return $skip;
}
add_filter( 'powered_cache_image_optimizer_skip_image', 'exclude_svg_images_from_optimization', 10, 3 );

How to disable Image Optimizer via Filter?

You can programmatically disable the image optimizer by using the powered_cache_image_optimizer_disable filter.

eg:

add_filter( 'powered_cache_image_optimizer_disable', function ( $disable ) {
	if ( is_page( 'your-page-slug' ) ) {
		$disable = true;
	}

	return $disable;
} );

Limitations