Filtering of allowed tags and attributes can be done using the wpsvg_allowed_tags
and wpsvg_allowed_attributes
filters. They’ve been available since version 1.6.0 of the plugin.
See below for use of these filters:
add_filter( 'wpsvg_allowed_tags', function ( $tags ) {
// Do what you want here...
// This should return an array so add your tags to
// to the $tags array before returning it. E.G.
$tags[] = 'use'; // This would allow the <use> element.
return $tags;
} );
add_filter( 'wpsvg_allowed_attributes', function ( $attributes ) {
// Do what you want here...
// This should return an array so add your attributes to
// to the $attributes array before returning it. E.G.
$attributes[] = 'target'; // This would allow the target="" attribute.
return $attributes;
} );
Filtering allowed tags and attributes