FAQ code doesn’t seem to add attributes
-
Hi there!
I am not sure what I am doing wrong but I need to change colours on some of my SVG’s depending on the page.
I mainly just need .class, fill and <style>
I have tried various things like this below, but nothing makes a difference. Am I being an idiot!?Thanks in advance!
add_filter( 'svg_allowed_tags', function ( $tags ) {
$tags[] = 'style';
return $tags;
} );
add_filter( 'svg_allowed_attributes', function ( $attributes ) {
$attributes[] = 'class'; // This would allow the target="" attribute.
return $attributes;
} );
You must be logged in to reply to this topic.