Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
WordPress Debugging
Tips and Tricks
KEANAN KOPPENHAVER
K.KOPPENHAVER@GMAIL.COM
@KKOPPENHAVER
Step 1:
Identify the problem
Step 2:
Find the cause
Step 3:
Find the solution
Step 4:
Repeat
Part 1 | Front End
What are Dev Tools?
(Spoiler Alert: They
help with debugging
step 2)
Developer Tools
• Bundled with most major browsers (Chrome,
Firefox, Safari)
• Allow you to inspect elements, console, net...
Demo:
Chrome Dev Tools
Bonus Tip:
Safari Dev Tools work with iOS
simulator
Part 2 | Back End
if ( $env == ‘development’ ) {
PLEASE USE WP_DEBUG;
(or WP_DEBUG_LOG)
}
Query Monitor
• Dev plugin runs in the background on every
page when enabled
• You can monitor much more than queries…
• H...
Demo:
Query Monitor
Let’s talk about
server logs
[03-May-2016 21:12:56 UTC] PHP Fatal error: Uncaught Error: Cannot
use object of type stdClass as array in /Users/keanan/c...
[03-May-2016 21:12:56 UTC] PHP Fatal error:
Uncaught Error: Cannot use object of type
stdClass as array in /Users/keanan/c...
302: <?php
303: $some_val = $post[ ‘some_val’ ];
304: ?>
302: <?php
303: $some_val = $post->some_val;
304: ?>
Questions?
KEANAN KOPPENHAVER
K.KOPPENHAVER@GMAIL.COM
@KKOPPENHAVER
WordPress Debugging Tips and Tricks
WordPress Debugging Tips and Tricks
WordPress Debugging Tips and Tricks
WordPress Debugging Tips and Tricks
Upcoming SlideShare
Loading in …5
×

WordPress Debugging Tips and Tricks

104 views

Published on

Everyone’s code has bugs. Luckily there are almost as many tools to help squash bugs as there are bugs to be squashed. In this talk, we took a detailed look at how to debug and fix some common issues associated with WordPress sites. We explored how Chrome’s Developer Tools can help us pinpoint front end bugs and used the Query Monitor plugin to see what was going on behind the scenes.

Published in: Internet
  • Be the first to comment

  • Be the first to like this

WordPress Debugging Tips and Tricks

  1. 1. WordPress Debugging Tips and Tricks KEANAN KOPPENHAVER K.KOPPENHAVER@GMAIL.COM @KKOPPENHAVER
  2. 2. Step 1: Identify the problem
  3. 3. Step 2: Find the cause
  4. 4. Step 3: Find the solution
  5. 5. Step 4: Repeat
  6. 6. Part 1 | Front End
  7. 7. What are Dev Tools?
  8. 8. (Spoiler Alert: They help with debugging step 2)
  9. 9. Developer Tools • Bundled with most major browsers (Chrome, Firefox, Safari) • Allow you to inspect elements, console, network traffic and much more • You can even code in dev tools (please don’t)
  10. 10. Demo: Chrome Dev Tools
  11. 11. Bonus Tip: Safari Dev Tools work with iOS simulator
  12. 12. Part 2 | Back End
  13. 13. if ( $env == ‘development’ ) { PLEASE USE WP_DEBUG; (or WP_DEBUG_LOG) }
  14. 14. Query Monitor • Dev plugin runs in the background on every page when enabled • You can monitor much more than queries… • Hooks, theme info, request info, oh my!
  15. 15. Demo: Query Monitor
  16. 16. Let’s talk about server logs
  17. 17. [03-May-2016 21:12:56 UTC] PHP Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /Users/keanan/code/Dev/ wordpress/wp-content/themes/clientname/lib/admin-helpers.php:303 Stack trace: #0 /Users/keanan/code/Dev/wordpress/wp-includes/plugin.php(525): RootsSageExtrasrestrict_adding_tags('') #1 /Users/keanan/code/Dev/wordpress/wp-settings.php(393): do_action('init') #2 /Users/keanan/code/Dev/wordpress/wp-config.php(85): require_once('/Users/keanan/co...') #3 /Users/keanan/code/Dev/wordpress/wp-load.php(37): require_once('/Users/keanan/co...') #4 /Users/keanan/code/Dev/wordpress/wp-admin/admin.php(31): require_once('/Users/keanan/co...') #5 /Users/keanan/code/Dev/wordpress/wp-admin/post.php(12): require_once('/Users/keanan/co...') #6 {main} thrown in /Users/keanan/code/Dev/wordpress/wp-content/themes/ clientname/lib/admin-helpers.php on line 303
  18. 18. [03-May-2016 21:12:56 UTC] PHP Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /Users/keanan/code/ Dev/wordpress/wp-content/themes/ clientname/lib/admin-helpers.php:303
  19. 19. 302: <?php 303: $some_val = $post[ ‘some_val’ ]; 304: ?>
  20. 20. 302: <?php 303: $some_val = $post->some_val; 304: ?>
  21. 21. Questions? KEANAN KOPPENHAVER K.KOPPENHAVER@GMAIL.COM @KKOPPENHAVER

×