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.

Debugging common errors in WordPress by Steve Mortiboy

417 views

Published on

My talk from WordCamp Raleigh 2016 on how to troubleshoot and debug errors in WordPress

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Debugging common errors in WordPress by Steve Mortiboy

  1. 1. Debugging Common Errors in WordPress By Steve Mortiboy
  2. 2. What we’ll learn • Where to get help when you have a problem • What to do before you start debugging • Standard troubleshooting procedures • WP_DEBUG • Understanding error messages • Debug Tools
  3. 3. WordPress Support – The Truths • Your site is down, you need support • Who you gonna call? • WordPress is open source software • It’s community developed, community supported • There is no phone number you can call • There is no email address you can use for help
  4. 4. WordPress Support Forums • https://wordpress.org/support/ • General Support Forums • Plugin support forums • Theme support forums • Other forums
  5. 5. WordPress Support Forums
  6. 6. Other Support Resources • Google • Plugin / Theme developer support • IRC - https://make.wordpress.org/support/irc-support-channel/ • Twitter • Paid support
  7. 7. Free vs Paid Support • When should you pay for support? • If you make money from WordPress • If your site is critical to your business • If you can afford it
  8. 8. How to ask for support • http://www.wpbeginner.com/beginners-guide/ how-to-properly-ask-for-wordpress-support-and-get-it/
  9. 9. Before you begin debugging • ALWAYS back up your site and your database • Back up your WordPress files and the database • Make sure you can restore from a backup • Practice this a few times and be sure it always works • Backup plugins: https://ithemes.com/purchase/backupbuddy/ https://wordpress.org/plugins/backwpup/ https://wordpress.org/plugins/backupwordpress/ https://wordpress.org/plugins/updraftplus/
  10. 10. Create a test environment • Copy your site to create a test site • Debugging on a live site is not always a good idea • Debug with a local install using MAMP / WAMP • https://www.mamp.info/ • http://www.wampserver.com/en/ • Debug in a subdomain (test.mydomain.com) • https://www.cpanel.com/media/tutorials/subdomain.htm • Make sure you have FTP access to your test site
  11. 11. Isolating the cause • Deactivate all plugins • Switch to the default Twenty Sixteen theme • Activate each plugin one at a time • Activate your theme • Does the problem occur during one of these steps
  12. 12. Enable WP_DEBUG • WP_DEBUG • define('WP_DEBUG', true); • WP_DEBUG_LOG • define('WP_DEBUG_LOG', true); • Log file is found at /wp-content/debug.log • WP_DEBUG_DISPLAY • define('WP_DEBUG_DISPLAY', false); • https://codex.wordpress.org/Debugging_in_WordPress
  13. 13. Check the debug log • Once you’ve enabled WP_DEBUG check the log file • The log file could contain errors, warnings and notices • Errors and warnings are what you’re looking for • Notices are informational only
  14. 14. Understanding error messages Fatal error: Call to undefined function my_function() in /wp-content/themes/mytheme/functions.php on line 12
  15. 15. Understanding error messages Fatal error: Cannot redeclare post_meta_function() (previously declared in /wp-content/themes/responsive/functions.php:114) in /wp-content/themes/mytheme/functions.php on line 26
  16. 16. Understanding error messages Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 17472 bytes) in /wp-content/plugins/myplugin/class.php on line 198
  17. 17. Searching Google for errors • Error messages in your debug log are specific to your site • Remove specific site information such as paths before searching • In the example below, remove the text in black which is site specific: /home/mysite/public_html/wp-content/themes/mytheme/functions.php
  18. 18. Further reading • http://codex.wordpress.org/ Common_WordPress_Errors#Specific_Error_Messages
  19. 19. The White Screen of Death
  20. 20. The White Screen of Death • Don’t panic • Disable all plugins • Deactivate your theme • Enable WP_DEBUG and WP_DEBUG_LOG • Check the log files • Ask for help
  21. 21. Further reading • https://codex.wordpress.org/ Common_WordPress_Errors#The_White_Screen_of_Death
  22. 22. Caching • Caching prevents good troubleshooting • Caching can come from: • Your browser • Your hosting provider • A third party service • A performance plugin • Empty all caches and disable all caching before troubleshooting
  23. 23. Debug Plugins • Debug Bar: https://wordpress.org/plugins/debug-bar/ • Debug Bar Extender: https://wordpress.org/plugins/debug-bar-extender/ • Query Monitor: https://wordpress.org/plugins/query-monitor/
  24. 24. What you can do next • Practice backing up and restoring your site • Practice creating a test site • Make sure you are familiar with WP_DEBUG • Participate in the WordPress.org Support Forums • Network with WordPress developers and users
  25. 25. Questions?
  26. 26. • Support • Security • Performance • Development • Design • SEO

×