Learn in this tutorial how to enable the new WordPress block editor in Easy Digital Downloads posts using code.
The block editor (Gutenberg) has been around for few years now, but there are still plugins that don’t have it enabled by default.
Easy Digital Downloads is one of them.
When you want to add a new download (that’s what the Custom Post Type that the plugin creates is called) it shows you the classic editor:
Would you prefer the new WordPress editor to be available in EDD as well?
You only need a few lines of code:
Snippet to enable the block editor in Easy Digital Downloads
Add the following code at the end of functions.php or in your functionality plugin:
To see this and another 1097 code snippets of this website, login or subscribe here.
As you can see, you have 2 possible ways to get support for the block editor in EDD.
In the first one you do it thanks to the Easy Digital Downloads dedicated filter, called edd_download_post_type_args. With it you add the show_in_rest argument as “true” to support the block editor.
If you choose the second one, you will use the register_post_type_args filter to tell it that the “Download” CPT (which is the one registered by EDD with the slug “download”) must support the block editor.
Both snippets are valid, so choose whichever one you’re more excited about (but only one of them!).
Conclusions
Do you want to enable the block editor in Easy Digital Downloads? Now you know two very simple ways to do it through code.
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. 😉