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
Chapter in this post:
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 ;)
Related Articles
Jens has been running the blog since 2012. He acts as Sir Apfelot for his readers and helps them with technical problems. In his spare time he rides electric unicycles, takes photos (preferably with the iPhone, of course), climbs around in the Hessian mountains or hikes with the family. His articles deal with Apple products, news from the world of drones or solutions to current bugs.
Worked perfectly on an Elementor issue. Thanks very much!
Doesn't work. Warnings are still displayed