fix: remove orphaned auto_inject code causing fatal error
This commit is contained in:
+4
-16
@@ -21,13 +21,13 @@ class Beep_Plugin {
|
||||
}
|
||||
|
||||
// Elementor widget — only load if Elementor is active
|
||||
add_action('elementor/widgets/register', function ($widgets_manager) {
|
||||
if (!class_exists('\\Elementor\\Widget_Base')) return;
|
||||
add_action('elementor/widgets/register', function () {
|
||||
if (!class_exists('\Elementor\Widget_Base')) return;
|
||||
$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());
|
||||
if (class_exists('\Elementor\Beep_Elementor_Widget')) {
|
||||
$widgets_manager->register(new \Elementor\Beep_Elementor_Widget());
|
||||
}
|
||||
}, 5);
|
||||
|
||||
@@ -35,18 +35,6 @@ class Beep_Plugin {
|
||||
add_action('admin_menu', [__CLASS__, 'add_admin_menu']);
|
||||
add_action('admin_init', [__CLASS__, 'register_settings']);
|
||||
}
|
||||
// Don't inject in feeds, REST, admin, etc.
|
||||
if (is_feed() || is_admin() || (defined('REST_REQUEST') && REST_REQUEST)) {
|
||||
return $content;
|
||||
}
|
||||
// Don't double-inject if content already has a beep feed
|
||||
if (strpos($content, 'data-beep-feed') !== false) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$feed = do_shortcode('[beep_feed limit="10"]');
|
||||
return $feed . $content;
|
||||
}
|
||||
|
||||
public static function add_admin_menu() {
|
||||
add_options_page(
|
||||
|
||||
Reference in New Issue
Block a user