1 | initial version |
The error "Call to undefined method Elementor\WidgetsManager::register()" occurs when trying to register a widget in Elementor using an outdated method. To fix this error, you need to change the register method to addcontrol in your code. Here are the steps to fix this error:
For example, replace the code:
$this->widgets_manager->register_widget_type( new \Elementor\Widget_Text() );
with:
$this->widgets_manager->add_control( 'text', [
'label' => __( 'Text', 'elementor' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => __( 'Default text', 'elementor' ),
] );
This should resolve the error and allow you to register your widget successfully in Elementor.