We wish building a website would be all butterflies and rainbows. Unfortunately, this is not the case and sometimes we find ourselves in a pickle when our website doesn’t work. Luckily debugging in WordPress is fairly simple and helps plugin and theme developers find a solution to the problem.
Getting the right information is crucial when reaching out for support. Luckily we’ve built a plugin for anyone to use to get some useful information that you may pass on to the support engineer helping you.
Editing Files On Your Site
Editing files on a live site can be risky, the most common way of editing files on a live website will be by using FTP, cPanel or some other file manager that is similar. Before moving forward, ensure you have a recent backup available. If you are uncertain about FTP or cPanel – you may reach out to your hosting provider for these details. We recommend Cyberduck when connecting to sites via FTP.
Enabling Debug Mode In WordPress
Once you are confident enough in using FTP to edit files on your site, you are ready to enable debugging in WordPress. Follow these simple steps –
- Login to your site via FTP using Cyberduck.
- Navigate to your WordPress install directory and enter it (usually public_html or www).
- Find wp-config.php file and edit with a text editor of your choice. If you don’t have a cool text editor, be sure to check-out Atom – it’s free.
- Search the file for the following line of code: define( ‘WP_DEBUG’, false );
- Change this from false to true. This will now output errors to your site, although it will conflict with functionality.
- Directly below this you will enter two new lines of code:
- define( ‘WP_DEBUG_DISPLAY’, true );
- define( ‘WP_DEBUG_LOG’, true );
- Save your file and re-upload to the same directory – overwrite the file when prompted. (Do not close Cyberduck just yet).
- Go back to your website using your browser and recreate the issue.
- Head back on over to FTP and navigate to wp-content and expand the folder, your debug.log file will be loaded into this directory if there are any PHP errors.
- Download the debug.log file and send it to your support thread.
Summary For Debugging In WordPress
Inside your wp-config.php file you will need to have the following lines of code to enable debugging in WordPress feature.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );
Once the above is enabled a debug.log file will be generated and added it to your wp-content directory. Download the debug.log and add it to your support thread reply. Once you have completed the steps above, be sure to delete the debug.log file and set ‘WP_DEBUG’ to false.
For more detailed information for debugging in WordPress, you may have look at the WordPress codex.