wordpress-website-lifecycle/debug/debug-post-requests.php

24 lines
611 B
PHP
Raw Permalink Normal View History

2025-01-17 21:42:31 +01:00
<?php
/*
* Insert this snippet at the top of wp-config.php
*/
2025-01-17 21:44:23 +01:00
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') {
2025-05-23 13:18:05 +02:00
error_log(sprintf('[HTTP POST] %s:%s', $_SERVER['REQUEST_URI'], json_encode($_POST)));
/*
file_put_contents(
WP_CONTENT_DIR.'/debug-post-request.log',
sprintf(
2025-05-24 08:38:25 +02:00
'%.2f %s %s %s%c',
2025-05-23 13:18:05 +02:00
microtime(true),
php_sapi_name() === 'cli' ? 'CLI' : $_SERVER['REMOTE_ADDR'],
$_SERVER['REQUEST_URI'],
json_encode($_POST),
10
),
FILE_APPEND | LOCK_EX
);
*/
2025-01-17 21:44:23 +01:00
}