// Safe wrapper to avoid blank pages and log errors add_action('init', function(){ if (shortcode_exists('ab-events')) { global $shortcode_tags; $orig = $shortcode_tags['ab-events']; $shortcode_tags['ab-events'] = function($atts = array(), $content = null) use ($orig) { ob_start(); try { $out = call_user_func($orig, $atts, $content); $buf = ob_get_clean(); $final = (string)$out . (string)$buf; if ($final === '') { error_log('[ab-events] Shortcode returned empty string.'); } return $final; } catch (Throwable $e) { error_log('[ab-events] ERROR ' . get_class($e) . ': ' . $e->getMessage() . ' @ ' . $e->getFile() . ':' . $e->getLine()); error_log('[ab-events] TRACE ' . $e->getTraceAsString()); ob_end_clean(); return '