Disable duotone svg output in theme.json
I noticed that my theme was outputting a dozen or so extra <svg>
s in the footer of my site’s HTML. So, I dug in to find out what and where the WordPress Block Editor (aka Gutenberg) was doing. Ideally, I wanted to remove this superfluous output. Unnecessary markup = unnecessary extra markup for browser engine’s to render.
First, I found out where this was happening in Gutenberg: lib/block-supports/duotone.php
I found that if you add the following to your theme.json
then the <svg>
will no longer be output.
{
"version": 1,
"settings": {
"color": {
"duotone": null
}
}
}
Of course, you will no longer have duotone options in the toolbar for blocks that support it, but that is fine by me.