allow svg wordpress
// Wp v4.7.1 and higher
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
$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' );
function fix_svg() {
echo '<style type="text/css">
.attachment-266x266, .thumbnail img {
width: 100% !important;
height: auto !important;
}
</style>';
}
add_action( 'admin_head', 'fix_svg' );function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
Also in PHP:
- $_GET['date']
- convert json to array php
- create a class in php
- Fatal error: Cannot redeclare
- check if string has comma php
- 'PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 282624 bytes)
- base64 decode
- catch error exception php
- eliminate duplicate characters in array php
- determine type in function php
- descargar laravel
- e_notice in php
- erreur php
- authenticate user with phone laravel
- divide page in pdf with page break using php
- codeigniter id of last insert
- Allowed memory size of 134217728 by php
- creayte date in ph
- How do I make a redirect in PHP?
- auto generate 6 string
- days or month php api format
- array_key_exists not finding numbers
- count elements of a string php
- date + 1 day in php