Earlier this week, Carl Hancock inquired on Twitter on whether or not a plugin exists that controls a user’s access to the code editor view in the block editor. His concerns centered around security issues, “Even if you use a plugin to manage block access via role/user the code editor allows unfettered access and manipulation to those that can get to it.”
A cursory search of the WordPress plugin directory using various search terms didn’t turn up any results. However, Chris Van Patten illustrated that it is indeed possible using a filter to limit user access to the code view editor.
This seems like a great idea for someone to create a plugin to accomplish this specific task or perhaps as an additional feature of an existing security plugin. If you know of a plugin that already does this or you create one, please let us know in the comments.