Discover in this tutorial how to disable WordPress block editor on the Custom Post Types (CPTs) you decide by code.
The block editor comes loaded with interesting and great features, but you may need a transition period until you start using it on all types of posts.
Is this your case? Do you want to disable the block editor in some CPTs?
You’ll see how easy it is:
Snippet to disable the block editor on a CPT
Two situations can arise:
- That the CPT plugin was created by you.
- Or that it is a plugin from WordPress repository.
Here is the solution for both possibilities.
1. With your own Custom Post Type Plugin
If you used the tutorial to create a CPT by code, just go to the line where it is located:
To see this and another 997 code snippets of this website, login or subscribe here.
It’s as simple as that. ๐
2. With a CPT plugin created by another developer
If the plugin has been developed by a third party, add this fragment in functions.php:
To see this and another 997 code snippets of this website, login or subscribe here.
With this code, the block editor will not be available in the CPT “Course” (i.e. with the slug “course”). Of course, I invite you to change it to the one you are interested in.
As this last snippet is not specific to Genesis, you can use it for any WordPress child themes.
Conclusions
If you prefer to wait before using the block editor in your CPTs, now you know how to disable it selectively by code.
But I recommend you to do this only temporarily, since the block editor has arrived to stay and the sooner you adapt your web or your clients’ web the better. ๐
If you also want information on how to adapt the Genesis child themes to the WordPress block editor, check the tutorial with all the optimizations you need to do to make sure it is compatible with it.
Any questions? I read you in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. ๐