In WordPress, we can upload images and files in the media section. and our media look like the below screenshot.

WordPress Media
WordPress Media

If you want to upload the SVG file into WordPress then WordPress does not allow us to upload the SVG files and giving below error.


We can resolve these issues by adding the Upload Mimes filter. To resolve this use the below code which will allow us to upload SVG files in WordPress media. Copy the below code and paste in your child theme. If you don’t have a child theme then please read our article “How to Create a Child Theme in WordPress”. 

function awblogger_add_svg_type($mimes){
 return $mimes;
add_filter('upload_mimes', 'awblogger_add_svg_type');

Please do let us know your thoughts on our article and write your comments.