Deactivate PHP warnings in WordPress in wp-config.php

Sometimes WordPress throws warnings or errors after upgrading to a new PHP version, which are caused by plugins or theme files that are no longer updated. Of course, as a long-term solution, you should try to switch to plugins or themes that are compatible with current PHP versions. However, if a forced update to PHP 7.1 has just been carried out on the customer account and the customer's website no longer loads because it is interrupted by error messages, then a short-term solution must be found. And I have summarized them for you here.

Related topic: Set the home URL and domain in the WordPress wp-config.php

Do you want to deactivate the PHP warnings on a WordPress website? They can be switched off with a little trick in the wp-config.php file.

Do you want to deactivate the PHP warnings on a WordPress website? They can be switched off with a little trick in the wp-config.php file.

Disable PHP warnings in WordPress - Here's how!

The short-term solution to the problem mentioned above is to tell PHP to simply stop throwing errors in the webpage's HTML output. All you have to do is call up the wp-config.php file and look for the following line in the code:

define ('WP_DEBUG', false);

Removes or highlights the line of code and replaces it with these commands:

ini_set ('log_errors', 'On'); ini_set ('display_errors', 'Off'); ini_set ('error_reporting', E_ALL); define ('WP_DEBUG', false); define ('WP_DEBUG_LOG', true); define ('WP_DEBUG_DISPLAY', false);

If the WordPress site is now called up in the web browser, the error messages should no longer be displayed. Of course, you should still address possible errors in plugins and themes. I have a trick for that too.

Implement error analysis via the IP address

If you want to start troubleshooting, it is helpful if you can already see the errors yourself, but not all other visitors. This can be solved with a query including the IP address. To do this, you first determine your own IP address (here is a guide to help you) and then replace the line mentioned above with the following code (where you have to enter the determined IP at 00.00.00.00):

if ($ _ SERVER ['REMOTE_ADDR'] == "00.00.00.00") {

  ini_set ('display_errors', 'On'); } else {

  ini_set ('log_errors', 'On');

  ini_set ('display_errors', 'Off');

  ini_set ('error_reporting', E_ALL);

  define ('WP_DEBUG', false);

  define ('WP_DEBUG_LOG', true);

  define ('WP_DEBUG_DISPLAY', false); }

Questions or requests for help with WordPress topics?

Do you have any questions about the topic or another problem in WordPress that you need help with? Then look like in the category SEO & Homepage drop by, leave a comment or send me an email. I have my help offer for blogger colleagues in this post summarized ;)

-
Do you like my blog? Then I would be happy to receive a short review on Google. Easy leave something here for a moment - that would be great, thank you!

Leave a Comment

Your e-mail address will not be published. Required fields are marked with * .