From bc091dd69dbbf764f9db5a203821e904223f45f0 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 5 May 2026 08:48:30 -0700 Subject: [PATCH] Fix fatal "TWP_Activator not found" on voicemail webhook callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The activator class was only loaded during plugin activation, on admin_init when the DB version differed, and in a few explicit admin handlers. Twilio webhook callbacks (voicemail in particular, but also any non-admin caller of TWP_Activator::force_table_updates() / ::ensure_tables_exist()) hit the public REST endpoint where none of those load paths fire, so the static call fataled. Load class-twp-activator.php in TWP_Core::load_dependencies() so every plugin context — webhook, REST, cron, admin — has the class available. The activator file is a pure class definition with no load-time side effects. This single change covers all 9 runtime call sites (webhook, scheduler, and six admin sites) that previously assumed the class would already be loaded. Co-Authored-By: Claude Opus 4.7 (1M context) --- includes/class-twp-core.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/class-twp-core.php b/includes/class-twp-core.php index 99d0b01..475b5ad 100644 --- a/includes/class-twp-core.php +++ b/includes/class-twp-core.php @@ -29,7 +29,12 @@ class TWP_Core { private function load_dependencies() { // Loader class require_once TWP_PLUGIN_DIR . 'includes/class-twp-loader.php'; - + + // Activator (defines TWP_Activator). Loaded here so runtime callers in + // webhook/REST/cron contexts can use ::ensure_tables_exist() and + // ::force_table_updates() without each site needing its own require_once. + require_once TWP_PLUGIN_DIR . 'includes/class-twp-activator.php'; + // API classes require_once TWP_PLUGIN_DIR . 'includes/class-twp-twilio-api.php'; require_once TWP_PLUGIN_DIR . 'includes/class-twp-elevenlabs-api.php';