Describe the bug
For some reason, when using Safe SVG uploading SVGs used to work within the customizer. Now they do not.
After some time testing, I managed to use a filter on Plupload which enabled uploading (plupload_default_settings)
I think this might be because Customizer uses Plupload, whose default config is missing svg from the allowed file extensions. But it worked before, so I am not sure really. In case it helps, this is what fixed it for me:
if (
isset( $settings['filters']['mime_types'] )
&& \is_array( $settings['filters']['mime_types'] )
) {
foreach ( $settings['filters']['mime_types'] as &$mime_type ) {
if (
isset( $mime_type['extensions'] )
&& \is_string( $mime_type['extensions'] )
&& \strpos( $mime_type['extensions'], 'svg' ) === false
) {
$mime_type['extensions'] .= ',svg,svgz';
}
}
}
Steps to Reproduce
- Add a custom customizer image via the theme customizer API http://codex.wordpress.org/Theme_Customization_API
- via
WP_Customize_Image_Control or WP_Customize_Media_Control
- try and add an SVG.
- The same SVG upload works in the media library, but not via the customizer.
Screenshots, screen recording, code snippet
See #279 (comment)
Environment information
all browsers etc
WordPress information
Latest WP. Tried with all plugins disabled apart from Safe SVG too.
Code of Conduct
Describe the bug
For some reason, when using Safe SVG uploading SVGs used to work within the customizer. Now they do not.
After some time testing, I managed to use a filter on Plupload which enabled uploading (
plupload_default_settings)I think this might be because Customizer uses Plupload, whose default config is missing svg from the allowed file extensions. But it worked before, so I am not sure really. In case it helps, this is what fixed it for me:
Steps to Reproduce
WP_Customize_Image_ControlorWP_Customize_Media_ControlScreenshots, screen recording, code snippet
See #279 (comment)
Environment information
all browsers etc
WordPress information
Latest WP. Tried with all plugins disabled apart from Safe SVG too.
Code of Conduct