How to disable the Code Editor in Gutenberg?


While there already are similar questions around this topic I have yet to find anything about disabling the Code editor in Gutenberg permanently, for all users:

Code editor

Using Gutenberg is a must, so I’m not looking for solutions regarding the classic editor or alternative editor plugins.

A code snippet that disables the editor would be much welcomed (I don’t want to use a UI-only option). If this can’t be achieved through hooks in the backend, I would also accept solutions that only affect the front end (since the backend receives HTML regardless of the editor used). Using display: none to hide the option would be one way to do it but I’d prefer a more permanent solution.

The main reason for this is for security. I have already disabled many blocks and the patterns.

I have already tried returning false on wp_code_editor_settings but that did not do anything to the Gutenberg editor.

Simao Gomes Viana 1 month 2023-02-15T07:49:26-05:00 0 Answers 0 views 0

Leave an answer