fix: elementor widget crash guard - check class_exists before registering
This commit is contained in:
@@ -20,11 +20,16 @@ class Beep_Plugin {
|
|||||||
update_option('beep_giphy_key', 'xuxYxuIvzPqw5tPB4laa7sQO8dFtSlNS');
|
update_option('beep_giphy_key', 'xuxYxuIvzPqw5tPB4laa7sQO8dFtSlNS');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Elementor widget
|
// Elementor widget — only load if Elementor is active
|
||||||
add_action('elementor/widgets/register', function ($widgets_manager) {
|
add_action('elementor/widgets/register', function ($widgets_manager) {
|
||||||
require_once BEEP_DIR . 'includes/class-elementor-widget.php';
|
if (!class_exists('\Elementor\Widget_Base')) return;
|
||||||
$widgets_manager->register(new \Elementor\Beep_Elementor_Widget());
|
$widget_file = BEEP_DIR . 'includes/class-elementor-widget.php';
|
||||||
});
|
if (!file_exists($widget_file)) return;
|
||||||
|
require_once $widget_file;
|
||||||
|
if (class_exists('\Elementor\Beep_Elementor_Widget')) {
|
||||||
|
$widgets_manager->register(new \Elementor\Beep_Elementor_Widget());
|
||||||
|
}
|
||||||
|
}, 5);
|
||||||
|
|
||||||
// Admin settings (Giphy API key only — full settings via Beep_Settings)
|
// Admin settings (Giphy API key only — full settings via Beep_Settings)
|
||||||
add_action('admin_menu', [__CLASS__, 'add_admin_menu']);
|
add_action('admin_menu', [__CLASS__, 'add_admin_menu']);
|
||||||
|
|||||||
Reference in New Issue
Block a user