WordPress does not allow SVG uploads by default. If you try to add an SVG logo, icon, or illustration through the Media Library, WordPress will usually display an error saying the file type is not permitted. The restriction is intentional: SVG files can contain scripts and other active content, so an untrusted file may pose a security risk.
You can still use SVG images on a WordPress website. The safest approach is to use a trusted plugin that sanitizes SVG files before they are added to your site. You can also enable SVG uploads with custom code, but that approach requires extra care because allowing the file type is not the same as making the file safe.
This guide explains why WordPress blocks SVG files, how to upload them safely, what to consider before using them, and how to fix common SVG upload problems.
Does WordPress Accept SVG Files by Default?
No. In a standard WordPress installation, the Media Library does not accept SVG files by default. SVG stands for Scalable Vector Graphics. Unlike JPEG and PNG images, an SVG is based on XML markup that describes shapes, paths, text, and other visual elements.
Because SVG files use markup, they can potentially include scripts, links, or other content that behaves differently from a simple raster image. A malicious SVG could put site visitors or administrators at risk, particularly if it is uploaded by an untrusted user and then opened or displayed in a browser.
WordPress restricts certain file types as a security measure. The exact upload permissions can also depend on your user role, site configuration, hosting environment, and whether your site is part of a WordPress Multisite network. Even if your account is an administrator, the default Media Library settings generally block SVG uploads.
Why Use SVG Files on a WordPress Website?
SVG files are useful for graphics that need to stay sharp at different sizes. Since they describe shapes rather than storing a fixed grid of pixels, they can scale without becoming blurry. This makes SVG a popular format for logos, icons, diagrams, and simple illustrations.
- Sharp at different sizes: An SVG logo can appear clearly on a small mobile screen or a large desktop display.
- Often lightweight: A simple, well-optimized SVG may be smaller than an equivalent high-resolution PNG.
- Easy to style: Some SVG graphics can be styled with CSS, depending on how they are included and how the file was created.
- Suitable for responsive layouts: SVG graphics can fit different screen sizes without needing several raster versions.
- Useful for accessible graphics: SVG markup can include a title and description, although accessibility still depends on how the image is implemented on the page.
SVG is not the best choice for every image. Photographs are generally better suited to formats such as JPEG, WebP, or AVIF. Complex SVG files can also become large, difficult to manage, or less compatible with image-editing features in WordPress.
How to Upload SVG Files to WordPress Safely
For most site owners, a reputable SVG plugin is the simplest option. Look for a plugin that actively sanitizes SVG markup, is maintained, and is compatible with your version of WordPress. Sanitizing means checking and cleaning the file to remove potentially unsafe code before it is stored or displayed.
Before installing a plugin, review its documentation and update history. Check whether it restricts SVG uploads to trusted user roles. On a site with multiple authors or contributors, it is especially important not to give every user permission to upload SVG files unless there is a clear need.
- Back up your website before changing upload settings.
- Install a well-maintained plugin from a source you trust.
- Enable SVG uploads only for the roles that need them, if the plugin offers that setting.
- Upload SVG files from trusted designers or prepare them using a reputable sanitizing tool.
- Test the image in the Media Library and on the front end after uploading.
- Keep WordPress, plugins, and themes updated.
Some SVG plugins provide a preview in the Media Library or allow SVGs to be used as featured images. These features can vary, so check the plugin’s settings and instructions rather than assuming every SVG-related feature is enabled automatically.
Can You Enable SVG Uploads with Code?
Developers can use WordPress filters to add the SVG MIME type to the list of permitted uploads. However, a MIME-type filter only changes which file types WordPress may accept; it does not sanitize the file. If you choose this approach, only trusted users should be allowed to upload SVGs, and the files should be sanitized before use.
A basic MIME-type example might look like this:
add_filter( 'upload_mimes', function ( $mimes ) {
if ( current_user_can( 'manage_options' ) ) {
$mimes['svg'] = 'image/svg+xml';
}
return $mimes;
} );
Add custom code through a small site-specific plugin or a child theme, not directly to a parent theme that may be replaced during an update. This example is not a complete security solution. It does not sanitize SVG content, and it may not address every restriction imposed by your hosting setup, WordPress configuration, or Multisite network.
For those reasons, using a maintained plugin with SVG sanitization is generally safer than adding a MIME type alone. If your project requires a custom implementation, ask a developer to review the upload permissions, sanitization process, and server configuration.
How to Add an SVG Logo or Icon to WordPress
Once SVG uploads are enabled safely, adding a graphic is similar to adding other media. Open the Media Library, select the upload option, and choose the SVG file. You can then add it to a page or post using the Image block or select it in a theme setting that supports uploaded logos.
Not every theme or plugin handles SVGs in the same way. A theme’s logo control may accept only certain image formats, or a page builder may offer its own image-selection and display options. If an SVG does not appear in a particular control, check that feature’s documentation and try inserting the image through a standard Image block.
After placing the SVG, check its appearance on desktop and mobile. Set an appropriate display size with the block or theme controls, and make sure the graphic has enough contrast against its background. If the SVG contains meaningful information, provide a useful alternative text description. If it is purely decorative, use empty alternative text where the editor or implementation allows it.
Common WordPress SVG Upload Problems
If WordPress still rejects an SVG after you have enabled support, check these common causes:
- The user role is restricted: The plugin or custom code may allow SVG uploads only for administrators. Sign in with an authorized account or adjust permissions carefully.
- The file is invalid: An SVG with malformed XML or unsupported content may fail validation. Ask the designer to export a clean SVG or run it through a trusted sanitizer.
- The host blocks the upload: A security rule, firewall, or server configuration may reject SVG files. Contact your hosting provider if the Media Library continues to show an upload error.
- A plugin or theme conflicts: Temporarily test the upload with other plugins disabled in a staging environment, if possible. Avoid making changes on a busy live site without a backup.
- The file has the wrong extension or content type: Renaming another file to “.svg” does not make it a valid SVG. Confirm that the file is genuinely an SVG image.
- The preview or dimensions are missing: WordPress may not handle SVG previews and image dimensions in exactly the same way as it handles JPEG or PNG files. A plugin may provide additional Media Library support.
Do not fix an upload error by disabling all security checks or allowing every user to upload every file type. Identify the specific restriction, then make the narrowest change that solves the problem.
SVG Images, Accessibility, and SEO
Using an SVG file does not automatically improve search rankings. Search engines primarily need a fast, accessible, well-structured page with useful content. An SVG can support a clean design and sharp graphics, but it should not replace descriptive page copy or meaningful alternative text.
For a logo that communicates your organization’s name, use alternative text that identifies the brand. For an icon that links to another page or performs an action, describe the link or action where appropriate. For a decorative divider or background graphic, avoid adding unnecessary descriptions that distract from the page content.
Performance also depends on the SVG itself. Remove unnecessary metadata and hidden elements, avoid excessively complex paths when a simpler graphic will work, and test the page with your usual performance tools. A large or poorly optimized SVG can be heavier than expected, so do not assume every vector file is automatically small.
When Should You Avoid SVG Uploads?
Choose another format when SVG does not offer a clear advantage or when your site cannot safely support it. Use a modern raster format for photographs, and consider PNG when you need transparency but do not need a scalable vector graphic. If you do not control who uploads media, enabling SVG uploads may create unnecessary risk.
You may also prefer a theme’s built-in logo option or a trusted asset-management workflow rather than uploading SVG files through the Media Library. The right choice depends on who manages the site, how the graphics will be used, and what security controls are available.
Conclusion: Does WordPress Accept SVG Files?
WordPress does not accept SVG files by default, but you can use them by enabling support. For most website owners, a reputable plugin that sanitizes SVG files is the safest and easiest option. Custom code can allow the file type, but a MIME-type change by itself does not make an SVG safe.
Use SVGs for suitable graphics such as logos and icons, restrict uploads to trusted users, and test files before publishing them. With careful setup, SVG images can look sharp across screen sizes while fitting into a secure, accessible WordPress website.