Skip to content

szepeviktor/debug-wordpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

Debug WordPress

theories

Tools and techniques for debugging WordPress.

Incoming HTTP requests

Dump HTTP request headers to debug-request-headers.log.
Install this plugin.
Follow error log: tail -f wp-content/debug-request-headers.log

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

What is happening?

  1. Hooks: log in all action.
  2. SQL queries: log at the end of wpdb::_do_query() in wp-includes/class-wpdb.php
  3. Object cache: log in WP_Object_Cache::get() and WP_Object_Cache::set() in wp-content/object-cache.php

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

  • query-monitor plugin
  • Test Mode plugin
  • Troubleshooting Mode of health-check plugin
  • airplane-mode plugin
  • whats-running plugin
  • frontend-debugger plugin
  • https://themecheck.info/

Sponsor this project

 

Contributors