Are you getting PHP error
on your WordPress site? Do you want to disable
PHP error? Also, have any of below questions? Then you are at right place.
- How to Turn Off PHP Errors in WordPress
- How to hide PHP Warnings and Notices in WordPress
- Debugging in WordPress
- PHP Notices, Warnings and Errors on Your WordPress Site
- Turn on WordPress Error Reporting
- How to enable or disable PHP error reporting for WordPress
do you know, there are quite a few sites out there with PHP warning and errors enabled by default and debug logs are easily readable to all of their users.
You definitely want to disable PHP warning and error reporting at front end 🙂
Check these out live site errors:
Oh 🙁
These errors are scary
. You can just search google with term crayon_formatter.class.php on line 36
and you will hundreds of site with this error. Again this is really bad. Ideally you shouldn’t show PHP warnings/errors to users.
How to disable these PHP Debug logs?
Just add below 2 lines to your wp-config.php file to disable warning appearing on live site.
define( 'WP_DEBUG', false ); define( 'WP_DEBUG_LOG', false );
How to enable these PHP Debug logs?
Just flip WP_DEBUG
and WP_DEBUG_LOG
to true
to enable PHP warning at front end.
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true );
Once you modify wp-config.php
file, save your changes and re-upload this to your server.
The errors will then get logged to the debug.log
file within your /wp-content/
folder. If for some reason you don’t see this file, please create one.
Is there any plugin available to see PHP error logs in Admin Console and on live site?
Yes. I would recommend to use plugin Query Monitor.
Plugin gives very detailed analysis on PHP errors with line level details. By that way, you can directly go to that page and fix an error.
I hope this tutorial helps you find and fix PHP errors very easily and fast.