Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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.

Joe McGill

May 12, 2018
Tweet

More Decks by Joe McGill

Other Decks in Technology

Transcript

  1. 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.
  2. 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.
  3. • 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
  4. @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
  5. @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
  6. @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