WordPress Allow SVG Uploads

DSDalton SuttonMarch 19, 2024
View AllHide Notes

How To Install

  1. Open your WordPress theme's functions.php file or a plugin's PHP file.
  2. Copy and paste the provided PHP snippet into the PHP file.
  3. Save the file.
  4. Adjust as needed.

function daltonsutton_svg_mime_types($mimes) {
  $mimes['svg'] = 'image/svg+xml';
  return $mimes;
add_filter('upload_mimes', 'daltonsutton_svg_mime_types');