SVG files are not supported by default in your WordPress installation, you can enable SVG support by using one of the following methods:
Method 1: Use a Plugin
- Log in to your WordPress admin dashboard.
- Go to “Plugins” and click on “Add New.”
- Search for a plugin called “Safe SVG” or “SVG Support”.
- Install and activate the plugin.
- Once activated, the plugin should enable SVG support for your WordPress installation.
Method 2: Edit the Theme’s Functions.php File
- Access your WordPress files via FTP or using a file manager provided by your hosting provider.
- Locate your active theme’s folder, which is usually located in the “wp-content/themes/” directory.
- In the theme’s folder, find the “functions.php” file.
- Download a backup copy of the “functions.php” file to your computer as a precaution.
- Open the “functions.php” file using a text editor.
- Add the following code at the end of the file:
function allow_svg_upload( $mimes ) { $mimes['svg'] = 'image/svg+xml'; return $mimes; } add_filter( 'upload_mimes', 'allow_svg_upload' );
- Save the changes and upload the modified “functions.php” file back to your server, overwriting the existing file if necessary.
By adding this code to your theme’s functions.php file, you are filtering the list of allowed upload file types and including the SVG format as a valid option. This should enable you to upload and use SVG images in your WordPress installation.
After making these changes, you should be able to upload SVG files through the WordPress media uploader and use them on your website. Remember to clear any caching plugins or caching services you may be using to ensure the changes take effect.