Debugging and Profiling in WordPress: What is My Site Doing?
Debugging and Proﬁling in WordPress:
" " " What Is My Site Doing?
Peter Baylies aka
@pbaylies on Twitter
Semper Fi Web Design
• Troubleshooting - be systematic
• Test against a development server
• Deactivate conﬂicting plugins
• Test against a default theme
• When all else fails...
• Edit your wp-conﬁg.php
• deﬁne( 'WP_DEBUG', true );
• deﬁne( 'WP_DEBUG_DISPLAY', false );
• Other options?
WP_DEBUG_LOG - debug.log ﬁle in /wp-content/
SCRIPT_DEBUG - use dev .css and .js for core
SAVEQUERIES - track MySQL queries
Advice and plugin recommendations too!
• Debug Bar - It's like FireBug for WordPress.
• Debug Bar Extender - with even more features.
• Query Monitor - Another take on both and more.
• Collect all three!
• ...yes, there are lots more.
What is 'Proﬁling'?
• extensive performance metrics
• data collection, data analysis
• can track function calls, runtimes, control ﬂow
P3 Plugin Proﬁler
• Made by GoDaddy
• Generates pretty graphs!
• It's ok I guess?
• Be careful interpreting its advice.
• Honestly - this isn't a real proﬁling tool at all.
• Made by Facebook
• It's a PHP extension - some assembly required.
• There's a WordPress plugin to help you use it:
WP XHProf Proﬁler"
• Execution time and memory use of all functions
• Shows a call graph of all functions
• Full-featured PHP debugging extension.
• Again, some assembly required.
• But once you have it working, it's very handy.
• Can integrate with many code editors.
• In theory can even do breakpoints (!)
• This is the fun part.
• Which of these would you like to see more of?
• Where did I confuse you the most?
• Thank you!
• Find this presentation on SlideShare
• Find me on Twitter: @pbaylies