Skip to content

Instantly share code, notes, and snippets.

@ocean90
Created March 28, 2013 13:35
Show Gist options
  • Save ocean90/5263152 to your computer and use it in GitHub Desktop.
Save ocean90/5263152 to your computer and use it in GitHub Desktop.
#WordPressPlugin: Allows you to upload SVG files through the media uploader.
<?php
/**
* Plugin Name: SVG
* Version: 1.0
* Description: Allows you to upload SVG files through the media uploader.
* Author: Dominik Schilling
* Author URI: http://wphelper.de/
* Plugin URI: https://gist.github.com/ocean90/5263152
*
* License: GPLv2 or later
*
* Copyright (C) 2012-2013 Dominik Schilling
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* Support for SVG images
*/
function ds_upload_mimes( $mimes ) {
$mimes[ 'svg' ] = 'image/svg+xml';
return $mimes;
}
add_filter( 'upload_mimes', 'ds_upload_mimes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment