LTroya
LTroya

Reputation: 540

How to deactivate Code Editor option on Gutenberg editor

I have been trying to deactivate the "Code editor" on the Gutenberg editor, but I haven't found any resource to achieve that.

All I haven't seen so far is how to disable the Gutenberg editor (there are even plugins to do that).

enter image description here

This was the closest approach I found but it didn't work.

Is there a way to achieve that?

Kind regards.

Upvotes: 0

Views: 216

Answers (1)

Melooo7
Melooo7

Reputation: 235

Please try the following code. You have to insert it into the functions.php of your child theme.

add_action('admin_head', 'orders_list_preview_css');
function orders_list_preview_css() {

    
echo "<script>
jQuery(document).ready(function($) {
   setTimeout(function() {
     $('.components-button').on('click', function () {
       setTimeout(function() {
       $('.profile-php .components-menu-item__item:contains(\"Code editor\")').closest('button').remove();},100)
       })
    },500)
})
</script>";}

Upvotes: 1

Related Questions