SlideShare a Scribd company logo
Debugging WordPress
Core & Plugins!
@bronsonquick
Overview
@bronsonquick
● Who Am I?
● Why Debugging Is Important
● Quick Debugging Wins
● WordPress Constants For Debugging
● Issues With Constants
● Chassis
● WordPress Plugins For Debugging
● Query Monitor
● Interactive Debugging
● Xdebug
Who Am I?
@bronsonquick
● Senior WordPress Developer
● Core Contributor
● Occasional WordPress Podcaster - WP Dev Table
● Maintainer Of Chassis
● Occasional WordCamp Organiser - WordCamp Gold Coast
& WordCamp Brisbane
● Massive Smashing Pumpkins Fan
● Vinyl Addict
● Guitar Fan
Why Is
Debugging Important?
@bronsonquick
Debugging WordPress Core and Plugins!
Quick Debugging Wins
@bronsonquick
define( ‘WP_DEBUG’, true );
@bronsonquick
define( ‘WP_DEBUG_LOG’, true );
debug.log
@bronsonquick
define( ‘SCRIPT_DEBUG’, true );
WordPress will use the "dev" versions
of core CSS and JavaScript files
rather than the minified versions.
@bronsonquick
define( ‘SAVEQUERIES’, true );
Saves the database queries to an
array and that array can be displayed
to help analyze those queries.
@bronsonquick
var_dump( $wcsc2016 );
echo( $wcsc2016 );
@bronsonquick
Issues With That Approach
@bronsonquick
● z-index issues - WordPress admin & themes
● Admin Ajax calls
● XML-RPC
● Cron jobs
● RSS Feeds
● REST API
● ….
Chassis
@bronsonquick
● Chassis - A Virtual Machine For WordPress Development
https://github.com/Chassis/Chassis/
● Docs - http://chassis.io/
● VirtualBox - https://www.virtualbox.org/
● Vagrant - https://www.vagrantup.com/
● Zeroconf networking (Bonjour)
Demo!
@bronsonquick
Improving Debugging With Plugins
@bronsonquick
● Debug Bar - https://wordpress.org/plugins/debug-bar/
● Debug Bar Extender - https://wordpress.org/plugins/debug-bar-extender/
● Debug Bar Cron - https://wordpress.org/plugins/debug-bar-cron/
● Debug Bar Transients - https://wordpress.org/plugins/debug-bar-transients/
● Log Deprecated Notices - https://wordpress.org/plugins/log-deprecated-notices/
● Rewrite Rules Inspector - https://wordpress.org/support/view/plugin-reviews/rewrite-rules-
inspector/
● Developer - https://wordpress.org/plugins/developer/
Demo!
@bronsonquick
Query Monitor
@bronsonquick
● Query Monitor - https://wordpress.org/plugins/query-monitor/
● Query, Caller, Component
Function - Core, Plugin & Theme
● HTTP Requests..
● Hooks & Actions That Are Fired
● HTTP Header Added - X-QM-Redirect-Trace
● Ajax Debugging (jQuery) - Clickable stack trace in your console
● Number Queries Performed, Slow Queries, Queries with errors, Memory Usage, Time
Taken, PHP Version, MySQL versions, Request Parameters, Clickable Stack Traces
● REST API Debugging
Demo!
@bronsonquick
Xdebug
@bronsonquick
● Xdebug Extension For Chassis - https://github.com/Chassis/Xdebug/
● PHPStorm
● Variable Inspection
● Set Breakpoints
● Step Into, Step Over
● Watches
Demo!
@bronsonquick
Questions?
@bronsonquick
Thanks!
@bronsonquick

More Related Content

Debugging WordPress Core and Plugins!

  • 1. Debugging WordPress Core & Plugins! @bronsonquick
  • 2. Overview @bronsonquick ● Who Am I? ● Why Debugging Is Important ● Quick Debugging Wins ● WordPress Constants For Debugging ● Issues With Constants ● Chassis ● WordPress Plugins For Debugging ● Query Monitor ● Interactive Debugging ● Xdebug
  • 3. Who Am I? @bronsonquick ● Senior WordPress Developer ● Core Contributor ● Occasional WordPress Podcaster - WP Dev Table ● Maintainer Of Chassis ● Occasional WordCamp Organiser - WordCamp Gold Coast & WordCamp Brisbane ● Massive Smashing Pumpkins Fan ● Vinyl Addict ● Guitar Fan
  • 7. define( ‘WP_DEBUG’, true ); @bronsonquick
  • 8. define( ‘WP_DEBUG_LOG’, true ); debug.log @bronsonquick
  • 9. define( ‘SCRIPT_DEBUG’, true ); WordPress will use the "dev" versions of core CSS and JavaScript files rather than the minified versions. @bronsonquick
  • 10. define( ‘SAVEQUERIES’, true ); Saves the database queries to an array and that array can be displayed to help analyze those queries. @bronsonquick
  • 11. var_dump( $wcsc2016 ); echo( $wcsc2016 ); @bronsonquick
  • 12. Issues With That Approach @bronsonquick ● z-index issues - WordPress admin & themes ● Admin Ajax calls ● XML-RPC ● Cron jobs ● RSS Feeds ● REST API ● ….
  • 13. Chassis @bronsonquick ● Chassis - A Virtual Machine For WordPress Development https://github.com/Chassis/Chassis/ ● Docs - http://chassis.io/ ● VirtualBox - https://www.virtualbox.org/ ● Vagrant - https://www.vagrantup.com/ ● Zeroconf networking (Bonjour)
  • 15. Improving Debugging With Plugins @bronsonquick ● Debug Bar - https://wordpress.org/plugins/debug-bar/ ● Debug Bar Extender - https://wordpress.org/plugins/debug-bar-extender/ ● Debug Bar Cron - https://wordpress.org/plugins/debug-bar-cron/ ● Debug Bar Transients - https://wordpress.org/plugins/debug-bar-transients/ ● Log Deprecated Notices - https://wordpress.org/plugins/log-deprecated-notices/ ● Rewrite Rules Inspector - https://wordpress.org/support/view/plugin-reviews/rewrite-rules- inspector/ ● Developer - https://wordpress.org/plugins/developer/
  • 17. Query Monitor @bronsonquick ● Query Monitor - https://wordpress.org/plugins/query-monitor/ ● Query, Caller, Component Function - Core, Plugin & Theme ● HTTP Requests.. ● Hooks & Actions That Are Fired ● HTTP Header Added - X-QM-Redirect-Trace ● Ajax Debugging (jQuery) - Clickable stack trace in your console ● Number Queries Performed, Slow Queries, Queries with errors, Memory Usage, Time Taken, PHP Version, MySQL versions, Request Parameters, Clickable Stack Traces ● REST API Debugging
  • 19. Xdebug @bronsonquick ● Xdebug Extension For Chassis - https://github.com/Chassis/Xdebug/ ● PHPStorm ● Variable Inspection ● Set Breakpoints ● Step Into, Step Over ● Watches