There are several ways to remove SVG from the header in WordPress:

  1. Using a plugin: There are several plugins available on the WordPress repository that can help you remove SVG from the header. One popular plugin is “Disable SVG” which allows you to disable the ability to upload SVG files to the media library, and it also removes the SVG MIME type from the list of allowed file types.
  2. Using functions.php: You can remove SVG from the header by adding a filter to your theme’s functions.php file.
function remove_svg_from_upload_mimes($upload_mimes) {
    unset($upload_mimes['svg']);
    unset($upload_mimes['svgz']);
    return $upload_mimes;
}
add_filter('upload_mimes', 'remove_svg_from_upload_mimes');

This code snippet will remove the SVG MIME type from the list of allowed file types.

  1. Using .htaccess: You can also remove SVG from the header by adding a line of code to your website’s .htaccess file, this will block all svg files from loading on your site.
<FilesMatch "\.svg$">
  Order Allow,Deny
  Deny from all
</FilesMatch>

It’s important to note that disabling SVG support may break some images on your site if they are in SVG format. Also make sure that you backup your website before making any changes to it.

(Visited 35 times, 1 visits today)
Was this article helpful?
YesNo
Close Search Window