Deprecation Notices and Warning Messages
What are Deprecation Notices?
Deprecation notices may look scary, but they aren't a bug or error and don't indicate an immediate problem with a plugin. Deprecation messages are there to inform PHP developers about code that will need to be updated in a future release (but it isn't urgent).
These notices may look like this in your browser:
Deprecated: File /gravityforms/includes/libraries/wp-async-request.php is deprecated
since version 2.9.8! Use /gravityforms/includes/async/class-wp-async-request.php instead.
But the Deprecation Notice Breaks my Website...
When text is output to the browser early in a request it can prevent redirects from working. Because WordPress does a lot of redirecting to different URLs, this is usually the main reason your website doesn't work. The good news is it's an easy fix!
On a production site, best practice is to turn off all PHP messages (including deprecation notices) so you and your users don't see them in your browser. This is the default mode on a standard WordPress installation. But sometimes debug mode gets turned on and then isn't disabled, or a web host configuration causes notices to be displayed.
How to Turn Off Deprecation Notices in a Production Environment
Create a backup of your website before attempting any changes. Should something go wrong you can easily restore your backup.
You'll need to edit your WordPress website's wp-config.php
file to disable PHP notices. This can be done with the File Manager tool provided by your web host, or using (S)FTP to download the file.
In the wp-config.php
file make sure the WP_DEBUG
constant is set to false
:
define( 'WP_DEBUG', false );
If the WP_DEBUG
constant is already set to false
and the deprecation notices are still displayed, try replacing that line with this block of code:
ini_set( 'display_errors', 'Off' );
ini_set( 'error_reporting', E_ALL );
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
If your wp-config.php
already has WP_DEBUG_DISPLAY
defined make sure to delete the line before adding the code block.
How to Turn Off Deprecation Notices in a Development Environment
If you've created a local development environment and don't want to see any deprecation notices you could turn off all PHP messages (see above).
If you prefer to display all PHP messages in the browser except deprecation notices, simply create a new PHP file in the /wp-content/mu-plugins/
directory called error-reporting.php
and include the following code:
<?php
error_reporting( E_ALL & ~E_DEPRECATED );
If the mu-plugins
folder doesn't exist go ahead and create it.
Reporting Deprecation Messages
Feel free to submit a support ticket to report any deprecation messages you find. Our team will add it to our backlog (if it isn't already there) and get it fixed in a future release.