Allow SVG in WP step by step

But how to know what is my WP namespace?

namespacing a function, in WP land, just means prefixing it with something that makes it more unique and unlikely to conflict with anything else. Generally that means you do both a “vendor” and a “package”. For instance, if I’m building a plugin, my function upload mimes function might be…

add_filter('upload_mimes', 'chrisguitarguy_pluginname_mimes');
function chrisguitarguy_pluginname_mimes($mimes)
{
    // ...
}

Where chrisguitarguy is my “vendor” name and pluginname is the package. You can do this PHP namespaces as well.

namespace Chrisguitarguy\PluginName;

add_action('upload_mimes', __NAMESPACE__.'\\mimes');
function mimes($mimes)
{
    // ...
}

Is anything else I shoud do?

Nope, what you have is perfect. You may want to specify that svgz is gzipped in your .htaccess.

AddType image/svg+xml .svg .svgz
// http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addencoding
AddEncoding gzip svgz

Newer versions of apache might include this config by default?