I noticed discussions on Git related to the deprecated elementor/widgets/widgets_registered
action and the register_widget_type
functions. In light of this, I attempted to restore their functionality while using 3.16.0.
I had some custom widgets which were affected by the 3.16.0. To address this issue, I applied the following code to my theme’s functions.php
file. I then provided the custom widget class name as an argument, and this approach successfully reinstated my missing widgets.
If you encounter similar issues with missing widgets, you can consider implementing the following code in your theme or child theme’s functions.php
file.
if (!function_exists('register_elementor_widget_type')) {
function register_elementor_widget_type($widget_class) {
add_action('elementor/widgets/widgets_registered', function ($widgets_manager) use ($widget_class) {
$widgets_manager->register_widget_type(new $widget_class());
});
}
}
if (!function_exists('elementor_widgets_init')) {
function elementor_widgets_init() {
if (!did_action('elementor/loaded')) {
return;
}
do_action('elementor/widgets/widgets_registered', Elementor\Plugin::$instance->widgets_manager);
}
}
add_action('init', 'elementor_widgets_init');
Please be aware that I’m not an expert, so if you identify any vulnerabilities in this code, I encourage you to point them out and exercise caution when using it. While this solution worked in my scenario, it may not be universally effective. Nonetheless, it serves as a temporary workaround until Elementor provides an official update to address this issue.