Divi Builder Custom Module

I developed a simple simple module for Divi builder. It is correctly displayed in the backend and frontend editor.

The problem is that it will not be saved in the backend or frontend editor at all. When I put it in the backend editor and save the message, it will be lost after restarting the internal editor!

Here is my module class:

class My_Custom_Module extends ET_Builder_Module { public function init() { $this->name = __('My Custom Module', 'wpl'); $this->slug = 'CUSTOM_SLUG'; } } new My_Custom_Module(); 

I completed this article https://jonathanbossenger.com/building-your-own-divi-builder-modules/ and How to create my own Divi module? and some other articles I found on Google.

I already tried to put some fields in the get_fields function, but that didn't help either.

Also, to make sure that this is not a conflict, I disabled all other plugins, but it did not fix it, so it is not related to the conflict.

+5
source share
2 answers

I finally found the problem myself, and I am sharing it here to help others if they run into the same problem.

The simple module in the question is not saved, because its slug, which lacks the et_pb_ prefix. It works fine when I change $this->slug = 'custom_module' to $this->slug = 'et_pb_custom_module' .

I did not see this rule in my documentation, but I hope they mentioned it somewhere.

Here is the working code for a simple Divi user module:

 function custom_divi_register_modules() { if(class_exists('ET_Builder_Module')) { class custom_divi_module extends ET_Builder_Module { public function init() { $this->name = __( 'Custom Module', 'et_builder' ); $this->slug = 'et_pb_custom_module'; $this->fb_support = true; } } new custom_divi_module; } } add_action('et_builder_ready', 'custom_divi_register_modules'); 
+6
source

It should not be. Wordpress may have a conflict caused by other plugins. What I would do is to make a new installation of Wordpress, apply the Divi theme, try to save the module. If he saves. You can then isolate the problem and find out which plugin is causing this problem by installing the plugins back one by one.

-1
source

All Articles