Uploads and limitseasy_svg_check_new_attachment()

easy_svg_check_new_attachment()

Safety net that sanitizes every new SVG attachment, or deletes it when it cannot be cleaned.

Function · Easy SVG · Status: Internal · Defined in easy-svg.php

Internal: not part of the promised public surface. It may change without notice.

Usage

easy_svg_check_new_attachment( int $attachment_id ): void

Example

remove_action( 'add_attachment', 'easy_svg_check_new_attachment' );

Description

Hooked on add_attachment and not tied to the SVG upload switch, so it also covers SVGs another plugin lets in. It only acts on readable local files inside the uploads directory (resolved with realpath), so offloaded media and files a plugin registers from its own folder are left alone. A file esw_svg_file_checker() refuses is deleted together with its attachment.

Parameters

body
$attachment_idint

The new attachment.

Removing this hook leaves SVGs from importers and other plugins unsanitized.