Pro Yearly is on sale from $80 to $50! »

Debugging WordPress – Tips, tricks, and tools

Debugging WordPress – Tips, tricks, and tools

No matter how big or small the job, using the right tools can make a big difference in the quality and consistency of your work. In this session, you'll learn about several tools that will make your life easier as a developer.

7cef1c9108207ec24db7a40f142db676?s=128

Joe McGill

May 12, 2018
Tweet

Transcript

  1. Debugging WordPress @joemcgill Joe McGill Senior WordPress Engineer, Human Made

    WordPress Core Developer
  2. “The best tool for debugging a coding problem is whatever

    tool you are comfortable using.”
  3. 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.
  4. 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.
  5. Debugging Constants Set constants in your wp-config.php file: define( 'WP_DEBUG',

    true );
  6. WordPress Developer Plugin

  7. • 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
  8. @joemcgill Query Monitor

  9. @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
  10. @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
  11. @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
  12. Joe McGill
 Senior WordPress Engineer, Human Made WordPress Core Developer

    @joemcgill Thank You