debugging common errors in wordpress by steve mortiboy
TRANSCRIPT
Debugging Common Errorsin WordPress
By Steve Mortiboy
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
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
WordPress Support Forums
• https://wordpress.org/support/• General Support Forums• Plugin support forums• Theme support forums• Other forums
WordPress Support Forums
Other Support Resources
• Google• Plugin / Theme developer support• IRC - https://make.wordpress.org/support/irc-support-channel/• Twitter• Paid support
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
How to ask for support
• http://www.wpbeginner.com/beginners-guide/how-to-properly-ask-for-wordpress-support-and-get-it/
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/
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
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
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
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
Understanding error messages
Fatal error: Call to undefined function my_function() in /wp-content/themes/mytheme/functions.php on line 12
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
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
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
Further reading
• http://codex.wordpress.org/Common_WordPress_Errors#Specific_Error_Messages
The White Screen of Death
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
Further reading
• https://codex.wordpress.org/Common_WordPress_Errors#The_White_Screen_of_Death
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
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/
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
Questions?
Steve MortiboySales Manager
[email protected] | @wpsmort
Semper Fi Web Design• Support• Security• Performance
• Development• Design• SEO
http://semperfiwebdesign.com