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. 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. WordPress Support Forums
• https://wordpress.org/support/
• General Support Forums
• Plugin support forums
• Theme support forums
• Other forums
6. Other Support Resources
• Google
• Plugin / Theme developer support
• IRC - https://make.wordpress.org/support/irc-support-channel/
• Twitter
• Paid support
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. How to ask for support
• http://www.wpbeginner.com/beginners-guide/
how-to-properly-ask-for-wordpress-support-and-get-it/
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. 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. 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. 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. 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. Understanding error messages
Fatal error:
Call to undefined function my_function()
in /wp-content/themes/mytheme/functions.php
on line 12
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. 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. 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
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
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. 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. 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
In this session I’ll discuss:
Where to get help
What to do before starting
Standard troubleshooting steps
How to use WP-DEBUG
Breaking down and understanding those pesky error messages
Various tools you can use for debugging
So why should this matter to you?
You may have been here -
It’s 4pm on a Friday and you just made a change to your mission critical site and now it’s down
This session will help you get through this nightmare
So let’s start by talking about some truths about WordPress support
We all agree WordPress is great, we love it
It’s free, it’s open source, it’s well developed, it’s highly customizable with plugins and themes
But it’s community developed and community supported
There’s no support team you can call or email
Take a second to look around you
Everyone here is part of the WordPress community
Which means everyone here is part of the support community
You all know something about WordPress that can help someone less knowledgeable
And when you need help you look for help from someone more knowledgeable
I’m sure you’re all very familiar with the WordPress.org support forums
You can find general support, support for plugins and themes in the WordPress.org repo
Here are the forums
On left in the sidebar of each forum page is the Forum Search
Perhaps not the best search in the world but it’s useful when searching for a specific error message
You can also perform a site search in Google
Here are some other resources you can use for support
We all like free, but we can’t expect everything to be free
Free could mean community support
Paid support in general will be better than free support
So when should you pay for support?
If you make money from WordPress, you sell a service or product that uses WordPress then you should pay for support
Ask yourself if it’s wrong to change your client for your time but then expect a plugin or theme developer to give their time for free
If your site is for a business and especially if it’s important to your business then you should pay for support
Your site generates revenue or is part of your sales and marketing so shouldn’t that mean it’s important enough that you pay for better support
If you can afford it, then pay
Too many great developers have left the WordPress community and their plugins or themes have gone away because they couldn’t sustain a business model where they gave their time away for free
If you don’t want to see that continue to happen, perhaps to a plugin or theme you use, then help the developer out by paying for support
It’s worth checking out this blog post by WP Beginner about how to ask for support
Too often I see someone ask for help in a manner that is unpleasant
If you’re respectful and helpful, you should receive the same in return
Now we’ve discussed support options, let’s move on to debugging
Before you begin troubleshooting anything ALWAYS back up your site
I recommend a backup plugin that backs up the files and database
I also recommend you make sure you know how to restore from your backup
Practice the backup and restore process a few times to make sure you’re comfortable with it and that it works every time
I use BackupBuddy from iThemes but there are other free and paid backup plugins available
Now you’ve backed up your site you can clone it by restoring the backup to a test site
Do you really want to be debugging and outputting messages on your live site?
Use a local environment with MAMP or WAMP
Or create a subdomain on your hosting and restore your site there
Creating a subdomain is easy in cPanel and I strongly recommend learning how to do this
Make sure you have FTP access to your site, you’ll need this to set WP_DEBUG and access the debug log
Whenever you start debugging, there are a set of standard steps you should always follow
This will help you isolate the cause of your problem
The steps are:
Deactivate all plugins
If the problem is resolved then you know it was probably caused by one of the plugins you deactivated
Switch to the default Twenty Sixteen theme
If the problem is resolved the you know is was probably caused by your theme
Activate each plugin one at a time until the problem occurs
The likelihood is that the plugin you activated when the problem reoccurred is the plugin that’s causing the issue
If you’ve deactivated all plugins and switched to the Twenty Sixteen theme and you still see the problem, you may need to reinstall WordPress
WP_DEBUG is a tool to help you debug problems on your site
You enable this is your wp-config.php file
The three main constants we can use in the wp-config.php file for debugging are:
WP_DEBUG – when you set this to true it will trigger WordPress debug mode and any errors will be output to your browser
WP_DEBUG_LOG – is a companion to WP_DEBUG. When you set this to true, WordPress will output debug information to a log file kept in the /wp-content/ directory
WP_DEBUG_DISPLAY – is another companion to WP_DEBUG. When you set this to false, errors will not be output to the screen
This last constant is useful if you’re debugging a live website and you don’t want the public to see ugly errors all over the screen
Always disable WP_DEBUG once you’re done
Now that you’ve enabled WP_DEBUG, check the log file for error messages
The log may contain a lot of information so it’s important to know what to look for
You may see errors, warnings and notices
Errors and warnings indicate a problem that you need to investigate
Notices are informational and can usually be ignored
Let’s look at a few examples of some error messages
We’ll break down each one so you can understand what they mean
In this error we see it says we have an undefined function
In other words, something is looking for a function that doesn’t exist
We see a path to a functions.php file in our theme
We see the line number in that file where the call is being made
So if we were to look at line 12 of the functions.php file in our mytheme theme we’d see code that’s calling a function called my_function but my_function doesn’t exist
As this is a theme problem, we’d contact the theme developer and ask for help
Remember to Google for the error message first to see if it’s being reported by other users and if the theme developer has responded with a fix
In this error we see it says that a function cannot be redeclared
In other words, the function has already been used by something else
We see a line number in a functions.php file where the function can be found
And we see a line number in another file where the function can be found again
You cannot have two functions with the same name or you’ll see this error
As this is a theme issue, we can ask the theme developer for support
Again, we’d Google the error message first to see if it’s already been reported and fixed or being fixed
In this last example, we see that memory has been exhausted
In other words, WordPress has run out of memory
We can see that it ran out of memory when trying to run a plugin
We could try increasing memory, there are instructions in the WordPress documentation on how to do this
Or we could follow the standard troubleshooting steps earlier to see if this is a plugin conflict
We may also want to contact the plugin developer and ask for help
Remember to Google the error message first to see if it’s a known issue
When you paste the error message in Google you may not get a result because the full message will be specific to your website
So be selective what you paste into Google
In the example here, the part of the file path in black is specific to only our site
Remove that text from the error before you Google it and just leave the part of the path starting with /wp-content
Here’s a link to further help on the WordPress Codex
You may have heard of or experienced the dreaded white screen of death
It can be the most intimidating of errors in WordPress
You do something such as activate a plugin or theme or save a change you made to a file and reload your web page and you get a blank screen
Don’t worry, there may be information there but it’s hidden from view
There’s a standard process many developers will recommend you follow
First, disable all plugins
You can do this by FTPing to your server, navigate to the /wp-content/ directory and renaming the plugins directory to old-plugins
Next, deactivate your theme by renaming it to old-theme, do this using FTP and navigating to the /wp-content/themes/ directory
Next, enable WP_DEBUG and WP_DEBUG_LOG and make sure WP_DEBUG_DISPLAY is set to true so that errors will be displayed on the screen
Next, refresh the browser and see if any error messages appear on the screen or in the log file in /wp-content/
Finally, ask for help in the WordPress support forums
You can find help with the white screen of death on the WordPress Codex
Whenever you’re debugging, you have to be aware of caching
Caching can happen in your browser, so clear use an incognito window and clear your browser cache
Caching can come from your hosting provider and they might not tell you what caching they do
Caching can come from a third party service provider such as CloudFlare or a CDN service
Caching can come from a plugin such as WP Super Cache
Make sure you empty all caches on any caching service and on any caching plugin and then disable caching
You can sometimes see if a page is cached by looking at the source code of the page and searching for the word cache
I have a couple of examples where caching can seriously frustrate your troubleshooting effort
--- WP Engine caching of the WP-Admin
--- Caching of PHP files by a hosting provider
If you want to take your debugging to the next level, there are also some great plugins for debugging WordPress
Debug Bar is written by the WordPress team, it adds a debug menu to the admin bar that helpful debugging information
Debug Bar Extender is a companion to Debug Bar and adds some more features
Query Monitor is a popular plugin amongst developers that displays information about database queries, memory usage and other information
It’s worthwhile asking around the community to see what different developers use and recommend
Practice your backup and restore process
You want to be very comfortable with this process so that when you need it, you can do it easily
Practice creating a test site both locally on MAMP or WAMP and on your hosting using a sub-domain
Again, make sure you’re comfortable with this process and can repeat both these processes with any site
Familiarize yourself with using WP_DEBUG and the debug log
Participate in the WordPress.org Support Forums
This will help you practice everything above and help others
Use events like WordCamps and Meetups as well as online communities to network with people who can answer your questions and help you practice your skils