debugging common errors in wordpress by steve mortiboy

27
Debugging Common Errors in WordPress By Steve Mortiboy

Upload: steve-mortiboy

Post on 13-Jan-2017

140 views

Category:

Internet


0 download

TRANSCRIPT

Page 1: Debugging common errors in WordPress by Steve Mortiboy

Debugging Common Errorsin WordPress

By Steve Mortiboy

Page 2: Debugging common errors in 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

Page 3: Debugging common errors in WordPress by Steve Mortiboy

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

Page 4: Debugging common errors in WordPress by Steve Mortiboy

WordPress Support Forums

• https://wordpress.org/support/• General Support Forums• Plugin support forums• Theme support forums• Other forums

Page 5: Debugging common errors in WordPress by Steve Mortiboy

WordPress Support Forums

Page 6: Debugging common errors in WordPress by Steve Mortiboy

Other Support Resources

• Google• Plugin / Theme developer support• IRC - https://make.wordpress.org/support/irc-support-channel/• Twitter• Paid support

Page 7: Debugging common errors in WordPress by Steve Mortiboy

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

Page 8: Debugging common errors in WordPress by Steve Mortiboy

How to ask for support

• http://www.wpbeginner.com/beginners-guide/how-to-properly-ask-for-wordpress-support-and-get-it/

Page 9: Debugging common errors in WordPress by Steve Mortiboy

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/

Page 10: Debugging common errors in WordPress by Steve Mortiboy

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

Page 11: Debugging common errors in WordPress by Steve Mortiboy

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

Page 12: Debugging common errors in WordPress by Steve Mortiboy

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

Page 13: Debugging common errors in WordPress by Steve Mortiboy

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

Page 14: Debugging common errors in WordPress by Steve Mortiboy

Understanding error messages

Fatal error: Call to undefined function my_function() in /wp-content/themes/mytheme/functions.php on line 12

Page 15: Debugging common errors in WordPress by Steve Mortiboy

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

Page 16: Debugging common errors in WordPress by Steve Mortiboy

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

Page 17: Debugging common errors in WordPress by Steve Mortiboy

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

Page 18: Debugging common errors in WordPress by Steve Mortiboy

Further reading

• http://codex.wordpress.org/Common_WordPress_Errors#Specific_Error_Messages

Page 19: Debugging common errors in WordPress by Steve Mortiboy

The White Screen of Death

Page 20: Debugging common errors in WordPress by Steve Mortiboy

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

Page 21: Debugging common errors in WordPress by Steve Mortiboy

Further reading

• https://codex.wordpress.org/Common_WordPress_Errors#The_White_Screen_of_Death

Page 22: Debugging common errors in WordPress by Steve Mortiboy

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

Page 23: Debugging common errors in WordPress by Steve Mortiboy

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/

Page 24: Debugging common errors in WordPress by Steve Mortiboy

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

Page 25: Debugging common errors in WordPress by Steve Mortiboy

Questions?

Page 26: Debugging common errors in WordPress by Steve Mortiboy

Steve MortiboySales Manager

[email protected] | @wpsmort

Page 27: Debugging common errors in WordPress by Steve Mortiboy

Semper Fi Web Design• Support• Security• Performance

• Development• Design• SEO

http://semperfiwebdesign.com