• We maintain multiple websites for a university, and have mostly been able to disable the features of Gutenberg we don’t need so that end users have a fairly simple interface for editing without going outside of the branding guidelines too much.

    But I’m struggling to find where to disable duotone (introduced in WP 5.8) and can’t find any related documentation. Can anyone point me in the right direction?

    Thanks!

Viewing 15 replies - 1 through 15 (of 17 total)
  • @jhamilt2 I don’t think you can disable it through UI as of yet. I would wait for someone to release a plugin. Not recommended to go deep and disable it via code. It can break things if not done properly.

    Hope that helps ??

    Hi @jhamilt2

    If you’re running 5.8, you should be able to disable the duotone settings completely using the new theme.json configuration. Assuming you don’t already have settings defined in theme.json, the file would look something like this:

    {
      "version": 1,
      "settings": {
        "color": {
          "duotone": [],
          "customDuotone": false
        }
      }
    }

    More details on theme.json usage can be found here.

    Hi @mattlitzinger,

    Unfortunately, the SVG wp-duotone in the footer is always there with your theme.json example.

    We need to be able to delete it if we don’t use Gutenberg.

    Thanks,

    Completely agree. Really getting annoyed by WP just forcing stuff on us devs without a clean and easy way to turn off things we aren’t using. I build highly customized with lots of restrictions (frontend & admin) as per the clients request and most don’t want anything to do with GB, so not being able to just turn it off in the settings and have to not include all it’s crap is getting more and more frustrating.

    For now I guess I’ll just have to comment out lines 459-467 in the wp-includes/block-supports/duotone.php file. Really don’t want to modify core files but with no other option to stop wp from dumping a bunch of svg’s into the wp_footer right now. Hope the WP devs update this in 5.9.1 to make this optional.

    • This reply was modified 2 years, 10 months ago by TheNerdCave.

    Classic Editor should hide this useless stuff too, asking here.

    WordPress please, don’t forget that your users are not only Twenty Theme beginners.

    I don’t use Gutemberg (i love classic editor) so i think it may be safe to do like this:

    remove_filter( 'render_block', 'wp_render_duotone_support', 10);

    so the duotone svg in the footer disappears!

    I tried adding remove_filter( 'render_block', 'wp_render_duotone_support', 10); but had no effect for me.

    This will remove the SVG, documented here

    {
    	"version": 1,
    	"settings": {
    		"color": {
    			"duotone": null
                    }
            }
    }

    But this’ll wipe out the Gutenberg styles within the editor. If you’re using classic editor, this won’t matter.

    If you want to remove the inline style tags in the header, you’ll remove those too, as shown here:
    https://github.com/WordPress/gutenberg/issues/24684#issuecomment-1022370212

    • This reply was modified 2 years, 9 months ago by jumbo.

    remove_filter( 'render_block', 'wp_render_duotone_support', 10);
    this filter doesn’t work any more in wp5.9, please tell me why…

    Jumbo’s explanation works.

    Jumbo’s explanation works.

    It works but it also ruines the gutenberg editing interface, making it totaly bugged.

    Here’s a github issue that touches upon the OP’s problem as well:
    https://github.com/WordPress/gutenberg/issues/38299

    It works but it also ruines the gutenberg editing interface, making it totaly bugged.

    That’s a definite downside. And trying to recreate the gutenberg styles within theme.json doesn’t seem possible without much trial and error.

    It would be nice if there were some way to merge a limited theme.json with the core defaults, but that doesn’t appear possible either.

    There doesn’t even appear to be a default, core theme.json file that could be referenced and used. Well, the new twenty-twenty-two theme has one, but its styles differ from the wordpress default.

    The following trac comment seems to resolve the issue:
    https://core.trac.www.ads-software.com/ticket/54941#comment:6

    It removes the gutenberg inline style tags within the head tag, the SVG HTML footer code, and doesn’t mangle the admin area gutenberg editor styles and interface. So no need to mess with theme.json.

    The following trac comment seems to resolve the issue:
    https://core.trac.www.ads-software.com/ticket/54941#comment:6

    Thanks @jumbo, it works perfectly.

    
    // Remove unwanted SVG filter injection WP
    remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
    remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
    
Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Disabling Gutenberg Duotone Filter?’ is closed to new replies.