What are PHP Errors, Warnings, and Notices on WordPress Sites?
WordPress is built with a programming language called PHP. This is by far the most popular language for websites, partly because it’s used to power WordPress.
As a result, you may sometimes see messages from PHP, even if you’re not familiar with the language.
In this guide, we’ll show you how to recognize and understand what PHP is saying to you. If you run a WordPress website, you don’t have to know code, but it’s very helpful f you can accurately delegate problems to people who can fix the issues.
If you want an easy way to find all these messages, this guide explains how to access PHP logs in WordPress.
PHP may show you three kinds of messages: Errors, Warnings and Notices. We’ll look at each of them in this guide.
PHP Errors in WordPress
Errors are by far the most important kind of PHP problems. Errors will most likely break your website. This image below shows an error from a plugin:
If there’s a fatal error on your site, your site will stop loading. You may see a message like this on below:
There are different types of errors, but many can not be recovered from. The scripts are halted on your website and you’ll need to fix the error before WordPress can run again.
Logtivity is a solution because it can notify you have any fatal errors. This image below shows a Slack notification for a Fatal Error. You can click the “View Error” button to immediately see full details on what’s wrong:
PHP Warnings in WordPress
Warnings deserve less attention than errors because they most likely won’t break your website. In most situations, the worst thing that will happen with Warnings is that they will show visibly on your site.
PHP Notices in WordPress
PHP notices are the least important message you may see. Sometimes a Notice will indicate an error, but sometimes it may only be a suggestion from PHP on ways in which the code can run better. Depending on what version of PHP you’re running, you may even see these Notices coming from the WordPress core. They are generally something you can ignore. This screenshot below shows an example notice. The plugin keeps on running smoothly despite this Notice.
How to Disable Error Reporting on Your Site
If you see error messages on your site and want to disable them, here are the steps to take:
- In the root of your WordPress website, find the wp-config.php file:
- Add the following code to this file:
- On some web hosts, setting WP_DEBUG to true may not work. You may also need to add this code to your wp-config.php file:
ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG_DISPLAY', false);
Easily Get Error Logs for Your Site
Errors logs are normally difficult to use. Most osting companies have terrible error reporting. When something goes wrong with a site, it’s really difficult to track down the problem using the hosting company’s tools.
This screenshot below is a preview of the “Errors” feature in Logtivity. You can see the errors, how often they occur, and when they last occurred. It doesn’t matter where your site is hosted. Our logs will record all Errors, Warnings, and Notices. To use this feature, you simply need to have the Logtivity plugin installed on your site.
How to Fix the Problem if You Can’t Code
This guide is aimed at people who are new to PHP and just want to report helpfully to developers.
Here are some tips to help solve the issues you see on your site.
- Search on Google and WordPress.org. See if someone already has reported the same error message and if they have found a solution. WordPress is so popular that someone has probably seen the same issue.
- Check that your WordPress site and all its plugins and themes are up-to-date.
- If you have just updated a plugin and you’re seeing errors, try going back to a previous version. A plugin such as WP Rollback can help.
- Study the message itself for hints about the issue. Often the message will point to the extension or theme that has prompted the problems. Disable the plugin or theme to check if that fixes the problem.
- If the steps above help you find the problematic plugin or theme, report the issue to the developer of that plugin or theme.