WordPress error handling is pretty good, but you do need to do a little work to shape this to your needs:
I can tell you that the most simple set-up I know is to log errors to the wp-content/debug.log file – using the following set-up in wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );
You can also extend the information in the log using xdebug – https://xdebug.org/ – but it’s not essential.
This should give you type, line and reason for all PHP error, like:
[30-Dec-2020 19:54:39 UTC] PHP Parse error: syntax error, unexpected 'an' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in C:\xampp\htdocs\file.php on line 10
Related Posts:
- Notice: Constant WP_POST_REVISIONS already defined
- How do I set up Debugging?
- “There doesn’t seem to be a wp-config.php file.” despite wp-config.php in root
- WordPress doesn’t recognise my email address and I’m missing the wp-config file in PHPmyadmin cPanel to make alterations
- Fatal error trace not shown in development setup
- Cannot access non-wordpress subdirectories as wordpress overrides them with a 404 error
- Showing errors with $wpdb update
- Change login error messages
- WP_DEBUG is not set, but I’m still getting warnings
- How to disable the fatal error (WSOD) protection?
- Unable to locate WordPress Content directory (wp-content)
- Could not create directory /wp-content/upgrade/
- Getting the warning: Missing argument 2 for manage_posts_custom_column()?
- What log files does a WordPress installation write to?
- How to display admin error notice if settings saved succesfully?
- HTTPS leads to Sorry, you are not allowed to access this page
- How to fix “There has been a critical error on your website. Please check your site admin email inbox for instructions”?
- Notice: Undefined index: host in /var/www/html/wp-includes/canonical.php on line 445
- What is the best way to monitor PHP functions/executions?
- Notice: Use of undefined constant SCRIPT_DEBUG
- Uncaught ReferenceError:switchEditors is not defined
- How to stop certain warning logging in error.log?
- WordPress Redirecting to wp-admin/install.php
- Upgrading PHP version results in “Use of undefined constant WP_CONTENT_DIR” warning?
- Error 404 Page Not Found When Updating a Post or Page
- Debug mode shows Strict Standards
- How to use WP_Error $data argument?
- Is it possible to disable caching of an option when using w3 total cache?
- Why on Earth am I getting “undefined_index” errors?
- Showing error “Function create_function() is deprecated”
- WordPress PHP error handling and reporting in production environment
- strange characters in wordpress website displayed for visitors [closed]
- Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 20480 bytes)
- Call to undefined function error after adding add_filter to wp-config
- Debugging ‘Object of class WP_Query could not be converted to int’ error
- How to fix ob_end_flush() error?
- When does remove_filter not work?
- wp_remote_get() not retrieving pages properly
- error_log over 70GB. How to stop this? [closed]
- $wpdb->insert Database Error Duplicate Entry Error Logging
- Update wordpress fail – There has been a critical error on your website
- This webpage is not available ERR_NAME_NOT_RESOLVED
- Displaying oEmbed errors?
- Getting headers already sent error from plugin
- “Apache HTTP Service has stopped working” with WP Query in WordPress 2.9.2
- Error 310 too many redirects after switching domains
- Error Logs to Diagnose Error 500 in LAMP
- Add image only in first post
- Error messages when adding code to function.php or trying to delete inactive plugin files
- “Notice: Undefined index:” error when adding new content?
- 418 header status, I’m a teapot [closed]
- Showing “ Notice: Undefined variable:” and “ Notice: Trying to get property of non-object”
- Publishing Time – WordPress Plain White Screen with No Error
- Object of class WP_Error could not be converted to string
- Notice: Constant already defined in wp-config.php on (non-existent) line?
- New WordPress Error Message – Not seen this before
- Does wordpress have an error log?
- WP_DISABLE_FATAL_ERROR_HANDLER vs WP_DEBUG ? What to use and when to use to see errors?
- Handling duplicates with wp_insert_term()
- Recommend a guide to catching plugin errors, please?
- How to handle core code throwing notice on valid input?
- Getting Warnings & Notices from Fresh WordPress 3.1.2 install
- Call to undefined function get_header() in index.php
- How can I create a custom page for this error?
- List Category Posts plugin upgrade fails with fatal error
- Sodium compat error
- Fatal error: require(): Failed opening required ‘WP_DIRwp-blog-header.php’
- What do these “Failed to import” errors mean and how do I fix it?
- How to get a Custom 500 Error Page to show?
- Dashboard Whitescreen of Death?
- add_sub_menu page() to be replaced by add_theme_page()
- How can I make wordpress suppress mysql errors?
- Trying to get property of non-object in wp-includes/capabilities.php
- How to use add_settings_error in register_setting callback
- How can I find the cause of theme crashing Apache in Xampplite?
- Allowed Memory Size Error in WordPress
- Application passwords not working on localhost?
- tb_show is not defined in advance custom field
- WordPress home page doesn’t work, but other pages do. How to rectify?
- Removing warnings and notices from production servers
- Unexpected Output: register_activation_hook with namespace
- WP Site Only Shows Javascript for Main Page
- File available but giving 404 in wordpress
- : Failed to load resource
- WordPress Admin Dashboard Does Not Display Correctly
- PHP notice coming from the WordPress core?
- What does this error mean? WordPress database error: [MySQL server has gone away]
- Warning: in_array() expects parameter 2 to be array, null given
- Fatal error: Call to undefined function is_multisite()
- Error trying to publish immediately. Post status = future (Missed schedule error)
- Can’t Change Theme And White Screen When Activating Any Plugin
- Get notified by email when Fatal error occurs on wordpress site?
- Call to undefined function
- Only on 404 page, get notice: trying to get property of non-object on nonce
- Error establishing a database connection on Installation
- Is there a way to avoid 404 pages in WordPress?
- Form Post results in 404 Not Found [duplicate]
- WordPress white screen with word ‘error’ [closed]
- In big trouble – Allowed memory size of 268435456 bytes exhausted
- Moving WP from local server to live, error establishing a db connection