[wp-trac] [WordPress Trac] #63302: SVG images can't be uploaded anymore due to a resizing issue
WordPress Trac
noreply at wordpress.org
Fri Apr 18 06:56:11 UTC 2025
#63302: SVG images can't be uploaded anymore due to a resizing issue
---------------------------------------+---------------------
Reporter: audrasjb | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.8.1
Component: Editor | Version: 6.8
Severity: normal | Resolution:
Keywords: has-screenshots has-patch | Focuses:
---------------------------------------+---------------------
Comment (by dilipbheda):
@pratiklondhe Thanks for testing!
You're right, it's not working with the safe-svg plugin because it only
allows SVG uploads in specific contexts using these hooks:
{{{
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'
) );
}}}
I tried calling `allow_svg_from_upload()` directly before these hooks,
like this:
{{{
$this->allow_svg_from_upload();
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'
) );
}}}
And it worked!
Also found where the plugin uses the upload_mimes filter:
https://plugins.trac.wordpress.org/browser/safe-svg/tags/2.3.1/safe-
svg.php#L134
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63302#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list