Problem 1: Admin SPA not loading in production
Root Cause: Vite builds require type='module' attribute on script tags
Solution: Added script_loader_tag filter to add type='module' to admin SPA script
Problem 2: Annoying MailQueue debug logs in console
Solution: Removed all error_log statements from MailQueue class
- Removed init() debug log
- Removed enqueue() debug log
- Removed all sendNow() debug logs (was 10+ lines)
- Kept only essential one-line log after successful send
Changes:
- includes/Admin/Assets.php: Add type='module' to wnw-admin script
- includes/Core/Mail/MailQueue.php: Remove debug logging noise
Result:
✅ Admin SPA now loads with proper ES module support
✅ MailQueue logs removed from console
✅ Email functionality still works (kept minimal logging)
Note: Production zip is 21M (includes .vite manifests and dynamic imports)
🐛 Issue: Action Scheduler completing but wp_mail() never called
🔍 Enhanced Debugging:
- Log sendNow() entry with all arguments
- Log argument type and value
- Handle array vs string arguments (Action Scheduler compatibility)
- Log payload retrieval status
- Log wp_mail() call and result
- Log WooEmailOverride disable/enable
- Check database for option existence if not found
- Log hook registration on init
📝 Debug Output:
[WooNooW MailQueue] Hook registered
[WooNooW MailQueue] sendNow() called with args
[WooNooW MailQueue] email_id type: string/array
[WooNooW MailQueue] email_id value: xxx
[WooNooW MailQueue] Processing email_id: xxx
[WooNooW MailQueue] Payload retrieved - To: xxx, Subject: xxx
[WooNooW MailQueue] Disabling WooEmailOverride
[WooNooW MailQueue] Calling wp_mail() now...
[WooNooW MailQueue] wp_mail() returned: TRUE/FALSE
[WooNooW MailQueue] Re-enabling WooEmailOverride
[WooNooW MailQueue] Sent and deleted email ID
🎯 This will reveal:
1. If sendNow() is being called at all
2. What arguments Action Scheduler is passing
3. If payload is found in wp_options
4. If wp_mail() is actually called
5. If wp_mail() succeeds or fails