Problem: PHP Warning: Declaration of ... should be compatible with ....
You will see this error when you (or your hosting company) upgrades to the latest php 7 which is great.
This is wp-cli output before the warnings were suppresses.
This is wp-cli output after the warnings were suppressed
The other problem is that based on the error reporting settings php will could show those warning messages to your users and/or in your log files. It would be stupid to run out of space because of those warnings. Suppressing all of the warnings is not a good idea as it will make the troubleshooting harder when it's needed.
There are multiple ways to fix this.
One of the ways to remove this php warning is that you will have to go and inspect the code where the warnings are coming from. This could be plugins/themes which contain php classes. It seems something has changed and php 7 doesn’t like it. This is because some method's parameters don’t method(s) those in their the parent class’ or vice versa. Then fix the parameters so they match.
This solution is long term, however, if you have full control over the code.
Ignore the warning and suppress it. In the context of WordPress plugins/themes it’s a tedious work to go through and fix each plugin or theme’s files. This is also pointless because a new update would override your changes anyways. This is the approach I’d recommend for the time being while the developers fix their code in the upcoming months.
You can use this code in a file that's get included first. This is usually a config file. In WordPress case you can add it to wp-config.php (right after the opening php tag: <?php or to your functions.php file.
If you'd rather install a WordPress plugin please check Orbisius Warning Suppressor plugin.
Were you also have been searching for:
- How to Suppress PHP Warning: Declaration of ... should be compatible with ....
- How to Remove PHP Warning: Declaration of ... should be compatible with ....
- How to Get rid of PHP Warning: Declaration of ... should be compatible with ....