Ask Your Question
1

What is the solution for the error "Call to undefined method Elementor\Widgets_Manager::register()"?

asked 2023-06-01 22:27:08 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-01 22:38:01 +0000

lakamha gravatar image

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:

  1. Locate the file where the error occurs.
  2. Search for the line that contains the method register.
  3. Change the method register to add_control.
  4. Save the file and refresh the page to see if the error is resolved.

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-01 22:27:08 +0000

Seen: 12 times

Last updated: Jun 01 '23