Slide 1

Slide 1 text

Debugging WordPress @joemcgill Joe McGill Senior WordPress Engineer, Human Made WordPress Core Developer

Slide 2

Slide 2 text

“The best tool for debugging a coding problem is whatever tool you are comfortable using.”

Slide 3

Slide 3 text

Before we begin debugging • Is WordPress up to date? • Are your plugins and theme up to date? • Are there any errors on the screen or in the browser JavaScript console.

Slide 4

Slide 4 text

Debugging Constants • WP_DEBUG – Display PHP errors, warnings and notices. • WP_DEBUG_LOG – Save errors to debug.log. • WP_DEBUG_DISPLAY – Hide errors from the browser. • SCRIPT_DEBUG – Will load dev versions of CSS/JS • SAVEQUERIES – Saves an array of each DB query that was run, along with execution time and which function called it.

Slide 5

Slide 5 text

Debugging Constants Set constants in your wp-config.php file: define( 'WP_DEBUG', true );

Slide 6

Slide 6 text

WordPress Developer Plugin

Slide 7

Slide 7 text

• Debug Bar – Add debugging tools to your admin bar • Debug Bar Console – A PHP/SQL console • Debug Bar Cron – See status of scheduled cron jobs • Rewrite Rules Inspector – View and flush rewrites • Log Depreciated Notices – Notice of deprecated functions. • User Switching – Quickly switch to another user • Beta Plugin – Run beta versions of WordPress WordPress Developer Plugin

Slide 8

Slide 8 text

@joemcgill Query Monitor

Slide 9

Slide 9 text

@joemcgill • See number of queries being run, and from where • See which conditionals are true • Which scripts/styles are enqueued • What hooks are being used • Environment information Query Monitor

Slide 10

Slide 10 text

@joemcgill Xdebug • A PHP debugger and profiler • Upgrades var_dump() • Adds stack traces for notices, errors, etc. • Editor extensions (PHPStorm, VS Code, Atom, etc.) • Many browser extensions

Slide 11

Slide 11 text

@joemcgill Other • A PHP debugger and profiler • Upgrades var_dump() • Adds stack traces for notices, errors, etc. • Editor extensions (PHPStorm, VS Code, Atom, etc.) • Many browser extensions

Slide 12

Slide 12 text

Joe McGill
 Senior WordPress Engineer, Human Made WordPress Core Developer @joemcgill Thank You