your biz, only better.

our super-focused ecourses will show you everything you need to know to create a killer online presence.

  check out our ecourses now!

Display Warnings: This Will Thrown An Error In A Future Version Of PHP

The WordPress debug and error log is a helpful tool when used by a developer, however, when it is switched on, sometimes you will get ugly warnings and notices on your website that look like this:

Many of the notices and warnings that pop up aren’t necessarily errors, but are just notifications that a tiny line of code that was used in one of your themes or plugins is going to be deprecated in the future.

But again — you don’t want or need that displaying on your site for all the world to see! So let’s get that fixed up.

Solution #1 – Try A Plugin

First off — I highly recommend solution #2 over this one, because it’s a surefire way to fix it. That being said, solution #1 is easier, so if you would like to try this route, go ahead.

If you have access to your WordPress admin area, you can try a plugin.

  1. Go to Plugins >> Add New and search for WP Debugging by Andy Fragen
  2. Once activated, go to Tools >> WP Debugging
  3. Modify the settings: specifically, make sure you select “Set WP_DEBUG_DISPLAY to false, default is true”
  4. Save your changes then refresh your page.
  5. If the notices and warnings are still there AND you have a caching plugin installed, make sure you clear that.

Unfortunately, I’ve found the plugin does not always take care of the errors. And that’s why we have solution #2…

RECOMMENDED Solution #2 – Edit Your wp-config.php File

This is a bit more intricate than solution #1 because you are going to need to access your core WordPress files using an FTP client like Filezilla, or a manager tool in your web host’s cPanel.

Once you have access, look for the wp-config.php file. It’s usually in the root folder:

Make sure you save a copy of it before you begin editing. You can use this as a back-up in the case you make a mistake while editing.

Open your wp-config.php file and look for a line of code mentioning the WP_DEBUG. It looks something like this:

Sometimes, just changing “true” to “false” and saving is enough. However, on certain environments, just adding this may not work and we need to add a bit more. So, I recommend deleting the current WP_DEBUG line and replacing with:

// Enable error log
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

What this will do is enable the debug log itself, but it will force warnings, errors, and notices to be logged in a separate file — not on the front end of your website.

Note: if your warnings are still showing on the front-end of the website after adding this, make sure 1) you clear your cache and any cacheing plugins, and 2) you have the plugin from solution #1 deactivated

Solution #3 – Contact Us!

We totally understand not wanting to mess around with a bunch of code.

If you’ve purchased one of our WordPress themes or have worked with us before, we offer this as a complimentary service.

Please get in touch with us and we’ll get it taken care of for you as soon as possible. Have your FTP credentials handy, as we will need them to access your core WordPress files and make the edit.