'How can I remove the "Advanced" panel of all blocks in WordPress block editor?

I want to optimize the WordPress block editor for my clients and hide everything that might confuse my clients. I've already removed several panels (colors, typography, etc.) via the theme.json (by deactivating all the available options within that panels), but I can't figure out how to remove the "Advanced" panel that has "HTML anchor" and "Additional CSS class(es)". How can I remove this panel? It would be great if there is a clean way to do this. Any ideas?

It can also be a Javascript or PHP solution if needed.



Solution 1:[1]

This can also likely be done in javascript, possibly using the addfilter hook.

You can use the poorly documented block_type_metadata hook although the strategy below will not work on blocks that are not registered with metadata from a block.json.

add_filter( 'block_type_metadata', 'remove_the_class_anchor' );
function remove_the_class_anchor($metadata ) {
    $metadata['supports']['customClassName'] = false;
    $metadata['supports']['anchor'] = false;
    return $metadata;
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Will