I'm looking for a way to hide some of the Page setting panels in the Gutenberg editor sidebar based on user role. Since there's no specific class for those panel headers I can't target them with CSS, so I was wondering if there's a way to at least control which panels are active in the Preferences:
Does anyone know if there's a hook or something I can use to conditionally pre-set these toggles based on user role?
Many thanks.
I've got something working on WordPress 5.9 (didn't test on earlier versions).
Include the JS from a plugin/theme
Here is the JS that does the trick. I simply check wether some features are checked/unchecked and toggle them.
This JSX file has been compiled with @wordpress/scripts