How to enable debugging in WordPress...

You have an issue on your website but you’re not sure what it is. This is the time to enable WordPress debugging. Here’s how to do that, and what you need to keep in mind.

But first, a few precautions:

  1. Only enable debugging when it’s necessary. Don’t keep it on 
  2. Display settings: Log issues quietly, but never expose them to the public (we’ll walk you through hiding this from visitors)
  3. Stay calm. Troubleshooting and debugging needs a clear, cool head
  4. Reach out to a professional if you are uncomfortable taking this on yourself
  5. You will need server access (where your website is hosted)

Now that you are prepared, here’s how to enable debugging:

Step 1: Enable debugging for WordPress

  1. First, you need to log into your hosting (via cpanel or FTP). In the public_html directory you will see a file called wp-config.php (exactly that, no other words or numbers can appear in the name of this file).
  2. If you see there is already a line towards the bottom that reads “define( ‘WP_DEBUG’, true );” or “define( ‘WP_DEBUG’, true );” – you already have a partial instruction. Skip to step 5. 
  3. Find the sentence “/* Add any custom values between this line and the “stop editing” line. */“
  4. Paste the below values here (and above the line “/* That’s all, stop editing! Happy publishing. */” 
				
					
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
				
			

Hit save, and head back over to your “public_html” folder and find the .htaccess folder. Click edit, and add the following script above the line “# END WordPress”.

This ensures your debug log is not publicly accessible, which is a security risk.

				
					<Files "debug.log">
    Require all denied
</Files>

				
			

Hit save again. 

Step 2: Check the debug log

Now go back to your public directory and find the subfolder called “wp-content”. Inside it, you will see a new file called debug.log (this file will only appear if there are actual errors on the site. You will not find it if your site has no errors). 

Once you find your debug log, download it. This document will contain any errors that are being triggered on your website. 

Finished debugging? Time to switch it off

Now that you’ve enabled debugging, you’ll want to view the log which has been created in on your server as a result of the previous step. Simply go back to your wp-config file and remove the lines you added in Step 1.

Note that the debug file will only start populating if there are bugs. So don’t immediately expect the file to be available and populated. 

That’s it. Happy debugging. 

Have a website issue?

Contact ALT Digital for help troubleshooting a WordPress website

More posts...

Best Practices to Improve Your Website’s Search Engine Rankings

Search engine optimization (SEO) is crucial for improving your website’s visibility in search engine results. In this article, we will explore the best practices to master SEO and boost your...

Enabling Local Business Schema in WordPress

Your website tells customers what your business does. But does it tell search engines where you operate, how to contact you and what services you provide? For businesses competing for...

The Benefits of Display Advertising

Display advertising is a powerful tool for building brand awareness and reaching new audiences. Here are a few of the benefits of incorporating display ads into your digital marketing strategy:

...
let's chat