echo “
“;
echo “
echo “
Form Submission Logs
“;
// Find WordPress
$wp_paths = [
__DIR__ . ‘/wp-load.php’,
__DIR__ . ‘/../wp-load.php’,
dirname(dirname(__FILE__)) . ‘/wp-load.php’
];
$wp_loaded = false;
foreach ($wp_paths as $wp_path) {
if (file_exists($wp_path)) {
require_once($wp_path);
$wp_loaded = true;
break;
}
}
if (!$wp_loaded) {
echo “
Could not find WordPress. Trying default path…
“;
$log_file = __DIR__ . ‘/wp-content/form-submissions.log’;
} else {
$log_file = WP_CONTENT_DIR . ‘/form-submissions.log’;
}
echo “
Log file location: $log_file
“;
if (file_exists($log_file)) {
$size = filesize($log_file);
echo “
✅ Log file exists! Size: ” . number_format($size) . ” bytes
“;
echo “
“;
$contents = file_get_contents($log_file);
echo “
Log Contents:
“;
echo “
" . htmlspecialchars($contents) . "
“;
echo “
“;
echo “
“;
if (isset($_GET[‘delete’])) {
unlink($log_file);
echo “
Log file deleted!
“;
}
} else {
echo “
❌ Log file does NOT exist yet.
“;
echo “
This means the hook is not firing. The form submission is not triggering the email function.
“;
// Try to create a test log
echo “
Testing Log Write…
“;
$test_write = @file_put_contents($log_file, “Test log entry: ” . date(‘Y-m-d H:i:s’) . “\n”);
if ($test_write) {
echo “
✅ Successfully created test log file!
“;
echo “
This means WordPress CAN write to wp-content/. The issue is the hook not firing.
“;
} else {
echo “
❌ Could not write to log file. Permission issue!
“;
echo “
WordPress cannot write to: ” . dirname($log_file) . “
“;
}
}
echo “
“;
echo “
After testing, delete this file for security!
“;
echo “