Exclude GIF auto-optimization in Imagify

Exclude GIF auto-optimization in Imagify on child sites.

Snippet Type

Execute on Child Sites

Snippet

function no_auto_optimize_gif( $optimize, $attachment_id, $metadata ) {
	if ( ! $optimize ) {
		return false;
	}

	$mime_type = get_post_mime_type( $attachment_id );

	return 'image/gif' !== $mime_type;
}
add_filter( 'imagify_auto_optimize_attachment', __NAMESPACE__ . '\no_auto_optimize_gif', 10, 3 );
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.