Reputation: 106
eg: In the Gutenberg "Heading" block there is the option to set the level to "H2, H3, H4". How (where) can i limit this list?
I only want to allow 'H3' for example
Looked everywhere on the internet. Filtering via 'registerBlockType' does not seem the way to go.
Upvotes: 2
Views: 344
Reputation: 486
There still doesn't seem to be a great solution to this particular thing yet, but you can essentially achieve the desired effect with something like this:
add_action('admin_head', function() {
echo '<style>
#editor .block-library-heading-level-toolbar button:nth-child(1),
#editor .block-library-heading-level-toolbar button:nth-child(4),
#editor .block-library-heading-level-toolbar button:nth-child(5),
#editor .block-library-heading-level-toolbar button:nth-child(6) {
display: none;
}
</style>';
});
Upvotes: 0
Reputation: 91
As far as I know there is no API for that kind of filtering. The workaround is to hide panels or buttons with display: none
. According to this discussion on Github Wordpress 5.4 might solve this issue.
Upvotes: 0