Skip to content

szepeviktor/debug-wordpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Debug WordPress

theories

Tools and techniques for debugging WordPress.

Incoming HTTP requests

Dump POST request body to the error log.
Copy this snippet to wp-config.php.
Follow error log: tail -f error_log

Tools

HTTP response headers

Open developer tools in your browser.

Tools

HTTP response body

View page source in your browser.

Important

Check Web Console for JavaScript errors.

Tools

PHP code

Dump triggered hooks (actions and filters) to a file.
Copy this MU plugin to wp-content/mu-plugins/.
Follow the log: tail -f wp-content/debug-hooks.log

Alternatively enable debugging in wp-config.

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
ini_set('display_errors', '0');

Follow the log: tail -f wp-content/debug.log

Tools

PHP errors

Follow PHP error log: tail -f error_log

Outbound HTTP requests

Log requests and responses.

Tools

  • snitch plugin
  • log-http-requests plugin

Cron events

Cron can be web-based and CLI-based.

Log events and failures.

Background queue jobs

Check Action Scheduler logs.

Database queries

Log queries before they are executed, see EXPLAIN statement.
Copy this snippet to wp-includes/class-wpdb.php.
Follow the log: tail -f wp-content/debug-queries.log

Log failed queries.

Tools

Emails

Log sent emails and sending failures.

Support my work

Please consider supporting my work as these lists take years to compile.

Sponsor

Thank you!

General debug tools

Sponsor this project