How to deactivate the block editor for each type of content


Since the Gutenberg project was proposed, it has seemed to me that it was something necessary, which I have been claiming for years, and that WordPress needs a design and layout tool to compete with the big ones like Wix or Weebly.

Over the months and years, the block editor has been incorporating new improvements and features in each WordPress update, but it still lacks something fundamental.

I mean that, despite my bet for WordPress to have a native layout, what always seemed to me a mistake is that block editing was active by default not only on pages, but also on posts.

It has always seemed to me a mistake to put in the hands of editors design tools, blocks that allow changing the layout and appearance of the contents, because I think it is something that should only be available for the creation and editing of pages, where it makes sense to apply design.

That said, as a clarification to my position, you can deactivate the block editor by content type, that is, you can leave it active for pages, but inactive for posts or any other type of content.

In other words, I don’t mean to completely disable the block editor and go back to the classic editor, but to only make the block editor available for certain types of content.

Disabling the block editor according to the type of content with code

If you want to, for example, disable the block editor for posts only, you would have to add this code to your customizations plugin:

/* Disable block editor for posts/entries */
add_filter('use_block_editor_for_post_type', 'disable_blocks_posts', 10, 2);
function disable_blocks_posts($gutenberg_filter, $post_type)
if ($post_type === 'post') return false;
return $gutenberg_filter;
}Code language: PHP (php)

If you want to disable it for some other type of content just change the $post_type.

The result is that you will have the block editor active for pages but not for posts.

Deactivate the block editor according to the type of content with a plugin

If you prefer to use a plugin for this purpose I recommend Disable Gutenberg.

Among its many settings, you have the possibility to determine in which of the content types of your website the block editor will be available.

If you go through its settings, in SettingsDisable Gutenberg, you will initially see that it is completely disabled, so the first step is to uncheck that first box so you can access the custom deactivation.

complete disable Gutenberg setting

Once you have done this you will see the enormous possibilities to customize where and for which user types you want to disable the block editor. Just make your selection and save changes.

custom disable Gutenberg settings

Well, I hope I have helped you to control where you can use the block editor and where not, so that your editors do not destroy the design of your website, for example.

How useful was this post?

Click on a smiley to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top