From df3f90014cdbc41e66a1ad9877e2349e2d39c6a7 Mon Sep 17 00:00:00 2001 From: Storm Rockwell Date: Wed, 4 Dec 2024 20:52:35 -0500 Subject: [PATCH] Allow SVGs to be uploaded on all admin pages --- safe-svg.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/safe-svg.php b/safe-svg.php index 6486b05..ef81f8d 100644 --- a/safe-svg.php +++ b/safe-svg.php @@ -128,14 +128,9 @@ public function __construct() { $this->sanitizer = new Sanitizer(); $this->sanitizer->minify( true ); - // Allow SVG uploads from specific contexts. - add_action( 'load-upload.php', array( $this, 'allow_svg_from_upload' ) ); - add_action( 'load-post-new.php', array( $this, 'allow_svg_from_upload' ) ); - add_action( 'load-post.php', array( $this, 'allow_svg_from_upload' ) ); - add_action( 'load-site-editor.php', array( $this, 'allow_svg_from_upload' ) ); - // Init all the things. add_action( 'init', array( $this, 'setup_blocks' ) ); + add_action( 'admin_init', array( $this, 'allow_svg_from_upload' ) ); add_filter( 'wp_handle_sideload_prefilter', array( $this, 'check_for_svg' ) ); add_filter( 'wp_handle_upload_prefilter', array( $this, 'check_for_svg' ) ); add_filter( 'wp_prepare_attachment_for_js', array( $this, 'fix_admin_preview' ), 10, 3 );