debugging wordpress core and plugins!

22
Debugging WordPress Core & Plugins! @bronsonquick

Upload: bronson-quick

Post on 16-Apr-2017

323 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Debugging WordPress Core and Plugins!

Debugging WordPressCore & Plugins!

@bronsonquick

Page 2: Debugging WordPress Core and Plugins!

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

Page 3: Debugging WordPress Core and Plugins!

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

Page 4: Debugging WordPress Core and Plugins!

Why IsDebugging Important?

@bronsonquick

Page 5: Debugging WordPress Core and Plugins!
Page 6: Debugging WordPress Core and Plugins!

Quick Debugging Wins

@bronsonquick

Page 7: Debugging WordPress Core and Plugins!

define( ‘WP_DEBUG’, true );

@bronsonquick

Page 8: Debugging WordPress Core and Plugins!

define( ‘WP_DEBUG_LOG’, true );

debug.log

@bronsonquick

Page 9: Debugging WordPress Core and Plugins!

define( ‘SCRIPT_DEBUG’, true );

WordPress will use the "dev" versions of core CSS and JavaScript files rather than the minified versions.

@bronsonquick

Page 10: Debugging WordPress Core and Plugins!

define( ‘SAVEQUERIES’, true );

Saves the database queries to an array and that array can be displayed

to help analyze those queries.

@bronsonquick

Page 11: Debugging WordPress Core and Plugins!

var_dump( $wcsc2016 );

echo( $wcsc2016 );

@bronsonquick

Page 12: Debugging WordPress Core and Plugins!

Issues With That Approach

@bronsonquick

● z-index issues - WordPress admin & themes

● Admin Ajax calls

● XML-RPC

● Cron jobs

● RSS Feeds

● REST API

● ….

Page 13: Debugging WordPress Core and Plugins!

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)

Page 14: Debugging WordPress Core and Plugins!

Demo!

@bronsonquick

Page 15: Debugging WordPress Core and Plugins!

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/

Page 16: Debugging WordPress Core and Plugins!

Demo!

@bronsonquick

Page 17: Debugging WordPress Core and Plugins!

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

Page 18: Debugging WordPress Core and Plugins!

Demo!

@bronsonquick

Page 19: Debugging WordPress Core and Plugins!

Xdebug

@bronsonquick

● Xdebug Extension For Chassis - https://github.com/Chassis/Xdebug/

● PHPStorm

● Variable Inspection

● Set Breakpoints

● Step Into, Step Over

● Watches

Page 20: Debugging WordPress Core and Plugins!

Demo!

@bronsonquick

Page 21: Debugging WordPress Core and Plugins!

Questions?

@bronsonquick

Page 22: Debugging WordPress Core and Plugins!

Thanks!

@bronsonquick