Learn in this tutorial how to get the custom fields of EDD posts displayed inside the WordPress block editor.
In a previous tutorial you already saw how to support the block editor in Easy Digital Downloads.
And here you are going to go one step further to enable custom fields in EDD posts that already use the block editor.
This, in addition to offering the inherent advantages of being able to use the new block editor along with your custom fields, allows you to support the Genesis sidebar introduced in Genesis 3.1.
But let’s take it step by step. ๐
Here’s how to support custom fields in EDD:
Steps to display the custom fields metabox in Easy Digital Downloads
1. Add support for custom fields in the EDD CPT
Add the following code snippet to your functionality plugin:
To see this and another 1097 code snippets of this website, login or subscribe here.
As you can see, thanks to Easy Digital Downloads dedicated filter called edd_download_supports you can support custom fields for this plugin easily.
Alright, now there is only one step left.
2. Display the custom fields in the block editor
It is not enough that your CPT supports custom fields, you have to tell the block editor to show you the metabox.
To do this, click on the three horizontal dots at the top right and go to “Preferences”:
Then activate and enable the “Custom Fields” toggle.
Now you’re done. ๐
With this the metabox to add, edit or modify EDD custom fields will appear.
In fact, this second part of the tutorial is great if you also want to show the custom fields in the normal entries and they didn’t appear until now.
Conclusions
Are you going crazy because you can’t find the custom-fields metabox once you’ve enabled the block editor on EDD entries?
Here is the solution.
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. ๐