How to troubleshoot a WordPress error that shows no log, message, or information?

Solution 1:

Follow these steps to enable WordPress debugging and log errors:

1. Edit wp-config.php
Add the following lines to your wp-config.php file, preferably above the line that says /* That’s all, stop editing! Happy blogging. */:


define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'display_errors', 1 );
define( 'SCRIPT_DEBUG', true );

2. Create a debug log file
Inside the wp-content directory, create a file named debug.log. Make sure it is writable by the server.

3. Check the log
Run your WordPress website as usual. All errors, warnings, and notices will now be logged in wp-content/debug.log. Open this file in any text editor to view the details.

Solution 2: Temporary Debugging by Modifying the Fatal Error Handler

WordPress masks fatal errors behind a generic message:

“The site is experiencing technical difficulties. Please check your email for instructions.”

These errors are handled in /wp-includes/class-wp-fatal-error-handler.php inside a try..catch block, which prevents the actual error message from being displayed.

A temporary debugging solution is to modify the handle() method to bypass the try..catch block and log the error message. Important: This modification should only be used for debugging and must be undone before putting the site into production.


public function handle() {
    if ( defined( 'WP_SANDBOX_SCRAPING' ) && WP_SANDBOX_SCRAPING ) {
        return;
    }

    // Detect the error
    $error = $this->detect_error();
    if ( ! $error ) {
        return;
    }

    // Log the error message
    error_log( $error["message"] );
    return;

    // Optional: Load default textdomain if necessary
    if ( ! isset( $GLOBALS['wp_locale'] ) && function_exists( 'load_default_textdomain' ) ) {
        load_default_textdomain();
    }

    if ( ! is_multisite() && wp_recovery_mode()->is_initialized() ) {
        wp_recovery_mode()->handle_error( $error );
    }

    // Display the PHP error template if headers not sent
    if ( is_admin() || ! headers_sent() ) {
        $this->display_error_template( $error );
    }

    // The original try..catch block is commented out for debugging
    // } catch ( Exception $e ) {
    //     // Catch exceptions and remain silent
    // }
}

Notes:

1. The error_log() function will log errors to wp-content/debug.log if this line exists in your wp-config.php:


define( 'WP_DEBUG_LOG', true );

2. Otherwise, errors will go to your server’s Apache/PHP error log.

3. This is a simple, quick way to see fatal errors. There are other approaches, but this is effective for immediate debugging.