enable svg uploads

This commit is contained in:
Aadil Ayub 2024-05-30 17:44:22 +05:00
parent 86c19ac3c5
commit 0458c96bea

View File

@ -31,6 +31,30 @@ function custom_wp_theme_json_default( $theme_json ) {
}
add_filter( 'wp_theme_json_data_default', 'custom_wp_theme_json_default' );
// enable svg uploads
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
global $wp_version;
if ( $wp_version !== '4.7.1' ) {
return $data;
}
$filetype = wp_check_filetype( $filename, $mimes );
return [
'ext' => $filetype['ext'],
'type' => $filetype['type'],
'proper_filename' => $data['proper_filename']
];
}, 10, 4 );
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
// define block styles
function jett_block_styles() {
register_block_style(
'core/heading',