Adding the SVG upload functionality to your WordPress site

Adding SVG upload functionality to WordPress site

SVG format is very important for chants and graphs. For admin orientated sites. There are many HTML admin templates which purely based on svg format. In HTML5 format SVG based graphs are too important. SVG is a language for describing two-dimensional vector graphics in XML. SVG stands for Scalable Vector Graphics.SVG defines graphics in XML format.

What is SVG?

  • SVG stands for Scalable Vector Graphics
  • SVG is used to define vector-based graphics for the Web
  • SVG defines the graphics in XML format
  • SVG graphics do NOT lose any quality if they are zoomed or resized
  • Every element and every attribute in SVG files can be animated
  • SVG is a W3C recommendation
  • SVG integrates with other W3C standards such as the DOM and XSL

SVG Advantages

Advantages of using SVG over other image formats (like JPEG and GIF) are:

  • SVG images can be created and edited with any text editor
  • SVG images can be searched, indexed, scripted, and compressed
  • SVG images are scalable
  • SVG images can be printed with high quality at any resolution
  • SVG images are zoomable (and the image can be zoomed without degradation)
  • SVG is an open standard
  • SVG files are pure XML

svg format is You can add this support by adding following in your functions.php file which you find in your wordpress theme folder.WordPress uploader does not support of SVG format files. Adding SVG upload functionality to WordPress. using our code your can use svg functionality in wordpress.

Adding SVG upload functionality to WordPress site

After adding following code you will be able to upload the svg file into your wordpress site or blog.

add_filter('upload_mimes', 'wpapi_upload_mimes');

function wpapi_upload_mimes($mimes = array()) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
Adding SVG upload functionality to WordPress site
Adding SVG upload functionality to WordPress site

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.