What's Actually Happening

Your WordPress site suddenly stopped working. Instead of seeing your website, visitors get a white screen (white screen of death), a generic error message, or a detailed fatal error showing "Uncaught Error" with a stack trace. The WordPress admin dashboard might also be inaccessible. This is a PHP fatal error that prevents WordPress from loading properly.

The "Uncaught Error" typically means PHP encountered a critical error that wasn't handled by try-catch blocks. Common causes include incompatible plugins, theme errors, PHP version mismatches, corrupted files, or memory exhaustion. The error halts PHP execution, so WordPress can't even display its own error page.

The Error You'll See

WordPress fatal errors appear in several formats:

```bash # White Screen of Death (WSOD) # Browser shows completely blank white page

# Detailed fatal error on screen Fatal error: Uncaught Error: Call to undefined function my_custom_function() in /var/www/wordpress/wp-content/plugins/my-plugin/my-plugin.php on line 45

Stack trace: #0 /var/www/wordpress/wp-includes/class-wp-hook.php(308): my_plugin_init() #1 /var/www/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #2 /var/www/wordpress/wp-includes/plugin.php(465): WP_Hook->do_action() #3 /var/www/wordpress/wp-settings.php(578): do_action('plugins_loaded') #4 /var/www/wordpress/wp-config.php(95): require_once('/var/www/wordpr...') #5 /var/www/wordpress/wp-load.php(50): require_once('/var/www/wordpr...') #6 /var/www/wordpress/wp-blog-header.php(13): require_once('/var/www/wordpr...') #7 /var/www/wordpress/index.php(17): require('/var/www/wordpr...') #8 {main} thrown in /var/www/wordpress/wp-content/plugins/my-plugin/my-plugin.php on line 45

# Class not found error Fatal error: Uncaught Error: Class 'WP_Block_Type_Registry' not found in /var/www/wordpress/wp-includes/blocks.php on line 23

# Memory exhausted error Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/wordpress/wp-content/plugins/woocommerce/includes/class-wc-product.php on line 1234

# Syntax error in plugin Parse error: syntax error, unexpected '}' in /var/www/wordpress/wp-content/themes/mytheme/functions.php on line 156

# Cannot redeclare function Fatal error: Cannot redeclare my_custom_function() (previously declared in /var/www/wordpress/wp-content/plugins/plugin1/functions.php:12) in /var/www/wordpress/wp-content/plugins/plugin2/functions.php on line 8

# WordPress email notification Subject: [Your Site] Your Site is Experiencing a Technical Issue

Howdy!

Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.

First, visit your website (https://example.com/) and check for any visible problems. Next, visit the page where the error was caught (https://example.com/wp-admin/).

There has been a critical error on your website.

Error Details ============= An error of type E_ERROR was caused in line 42 of the file /var/www/wordpress/wp-content/plugins/broken-plugin/plugin.php. Error message: Uncaught Error: Call to a member function get_id() on bool

# In PHP error logs [08-Apr-2026 10:15:23 UTC] PHP Fatal error: Uncaught Error: Call to undefined function get_current_screen() in /var/www/wordpress/wp-content/plugins/my-plugin/admin.php:15

# In WordPress debug.log [08-Apr-2026 10:15:24 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in /var/www/wordpress/wp-includes/functions.php on line 4567 ```

Additional symptoms: - Site returns HTTP 500 Internal Server Error - Admin dashboard shows same error or is inaccessible - Some pages work while others don't - Error appeared after plugin/theme update - Site works for logged-in users but not visitors - Error only appears on certain pages - Widgets or shortcodes not rendering

Why This Happens

  1. 1.Plugin Compatibility Issues: A plugin was recently installed or updated and is incompatible with your WordPress version, PHP version, or other plugins. The plugin tries to call functions or classes that don't exist in your environment.
  2. 2.Theme Errors: Your theme's functions.php or template files have PHP syntax errors, call undefined functions, or reference missing classes. Theme updates can introduce breaking changes.
  3. 3.PHP Version Incompatibility: Your server runs an older PHP version (7.4 or older) but a plugin requires PHP 8.0+. Or vice versa - code written for PHP 7 doesn't work with PHP 8 due to removed functions or changed behaviors.
  4. 4.Memory Exhaustion: WordPress or a plugin tries to use more memory than the PHP memory_limit allows. Large sites with many plugins, complex themes, or WooCommerce can hit memory limits.
  5. 5.Corrupted Files: Plugin or core WordPress files were corrupted during update, by malware, file system errors, or incomplete uploads. Missing or partial files cause fatal errors when PHP tries to load them.
  6. 6.Plugin Conflicts: Two plugins try to define the same function or class, causing "Cannot redeclare" errors. Plugins hook into same filters with conflicting logic.
  7. 7.Missing Required Plugins: A theme or plugin requires another plugin to be installed and active. When the required plugin is missing, fatal errors occur.
  8. 8.Database Issues: Database tables are corrupted, missing, or have wrong schema. WordPress tries to query non-existent tables or columns.

Step 1: Enable Debugging and Identify the Error

First, see the actual error message instead of a white screen.

```bash # SSH into your server cd /var/www/wordpress

# Enable WordPress debugging # Edit wp-config.php: nano wp-config.php

# Add these lines before "That's all, stop editing!": define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); define( 'SCRIPT_DEBUG', true );

# Save and check debug log: tail -100 wp-content/debug.log

# Check PHP error logs: tail -100 /var/log/php-fpm/error.log tail -100 /var/log/apache2/error.log tail -100 /var/log/nginx/error.log tail -100 /var/log/php_errors.log

# Check specific error in debug.log: grep -i "fatal|error|uncaught" wp-content/debug.log | tail -20

# Identify the problematic file from the error message: # Example: "in /var/www/wordpress/wp-content/plugins/bad-plugin/plugin.php on line 42" # The error is in: wp-content/plugins/bad-plugin/plugin.php

# Test if error is visible in browser now: curl -I https://example.com/

# Check if admin works: curl -I https://example.com/wp-admin/

# Look for recent changes: ls -lt wp-content/plugins/ | head -20 ls -lt wp-content/themes/ | head -10 ```

Step 2: Disable All Plugins to Isolate the Problem

Determine if the error is caused by a plugin.

```bash # Method 1: Rename plugins folder via SSH cd /var/www/wordpress/wp-content mv plugins plugins.disabled

# Create empty plugins folder: mkdir plugins

# Test if site loads now: curl -I https://example.com/

# If site works, a plugin was causing the error # Restore plugins folder: rm -rf plugins mv plugins.disabled plugins

# Method 2: Disable plugins via database mysql -u wordpress_user -p wordpress_db

# Update active_plugins option: UPDATE wp_options SET option_value = 'a:0:{}' WHERE option_name = 'active_plugins';

# Exit MySQL: exit

# Test site now curl -I https://example.com/

# Method 3: Disable specific plugin by renaming cd /var/www/wordpress/wp-content/plugins

# List plugins: ls -la

# Disable suspect plugin: mv problem-plugin problem-plugin.disabled

# Test site

# Re-enable: mv problem-plugin.disabled problem-plugin

# Method 4: Use WP-CLI if available: wp plugin list --status=active wp plugin deactivate --all

# Test site, then reactivate one by one: wp plugin activate plugin-name ```

Step 3: Switch to Default Theme

Determine if your theme is causing the error.

```bash # Method 1: Via SSH - rename theme folder cd /var/www/wordpress/wp-content/themes mv your-theme your-theme.disabled

# WordPress will fall back to a default theme # Test if site loads

# Method 2: Via database - switch to default theme mysql -u wordpress_user -p wordpress_db << 'EOF' UPDATE wp_options SET option_value = 'twentytwentyfour' WHERE option_name = 'template'; UPDATE wp_options SET option_value = 'twentytwentyfour' WHERE option_name = 'stylesheet'; UPDATE wp_options SET option_value = 'twentytwentyfour' WHERE option_name = 'current_theme'; EOF

# Test site: curl -I https://example.com/

# If error is gone, your theme was the problem

# Method 3: Via WP-CLI: wp theme list wp theme activate twentytwentyfour

# Test, then reactivate: wp theme activate your-theme ```

Step 4: Fix PHP Memory Limit Issues

Resolve memory exhaustion errors.

```bash # Check current memory limit: php -i | grep memory_limit

# Edit wp-config.php to increase memory: nano wp-config.php

# Add before "That's all, stop editing!": define( 'WP_MEMORY_LIMIT', '512M' ); define( 'WP_MAX_MEMORY_LIMIT', '512M' );

# If that doesn't work, edit PHP configuration: # Find php.ini: php --ini

# Edit the file: sudo nano /etc/php/8.2/fpm/php.ini

# Find and change: memory_limit = 512M

# For shared hosting, add to .htaccess: echo "php_value memory_limit 512M" >> .htaccess

# Or .user.ini: echo "memory_limit = 512M" >> .user.ini

# Restart PHP-FPM: sudo systemctl restart php8.2-fpm

# Verify change: php -i | grep memory_limit

# Test site again

# If still failing, identify memory-hungry plugin: wp profile eval 'do_action("plugins_loaded");' --fields=time,memory

# Check debug log for which plugin is consuming memory: grep "exhausted" wp-content/debug.log ```

Step 5: Fix Plugin-Specific Errors

Address errors from specific plugins.

```bash # Identify which plugin from error message: # Error shows path like: wp-content/plugins/plugin-name/file.php

# Check plugin's requirements: cat wp-content/plugins/plugin-name/readme.txt | grep -A20 "Requires"

# Check PHP version compatibility: php -v cat wp-content/plugins/plugin-name/readme.txt | grep "Requires PHP"

# If PHP version mismatch, upgrade PHP or find alternative plugin

# Check for missing dependencies: cat wp-content/plugins/plugin-name/plugin-name.php | head -50

# Update plugin to latest version: # Download fresh copy from WordPress.org: cd /tmp wget https://downloads.wordpress.org/plugin/plugin-name.latest-stable.zip unzip plugin-name.latest-stable.zip

# Backup old version: cp -r /var/www/wordpress/wp-content/plugins/plugin-name /var/www/wordpress/wp-content/plugins/plugin-name.backup

# Replace with new version: rm -rf /var/www/wordpress/wp-content/plugins/plugin-name cp -r plugin-name /var/www/wordpress/wp-content/plugins/

# Clear cache: rm -rf wp-content/cache/*

# Test site

# If still broken, look for plugin conflict: # Enable WP_DEBUG and check logs: tail -f wp-content/debug.log

# Disable all other plugins, test with just problem plugin ```

Step 6: Fix Theme Functions.php Errors

Repair errors in your theme's functions file.

```bash # Locate error in theme: grep -n "error" wp-content/themes/your-theme/functions.php

# If error shows specific line, check that line: sed -n '40,50p' wp-content/themes/your-theme/functions.php

# Common issues:

# 1. Missing opening <?php tag head -1 wp-content/themes/your-theme/functions.php

# 2. Extra whitespace before <?php head -5 wp-content/themes/your-theme/functions.php | cat -A # Should not show whitespace before <?php

# 3. Syntax errors - validate PHP: php -l wp-content/themes/your-theme/functions.php

# 4. Undefined function calls: grep "add_action|add_filter" wp-content/themes/your-theme/functions.php

# Fix syntax errors: nano wp-content/themes/your-theme/functions.php

# Comment out problematic sections: /* // Problem code here add_action('init', 'broken_function'); */

# Test site

# If can't fix, restore from backup: cp wp-content/themes/your-theme/functions.php.backup wp-content/themes/your-theme/functions.php

# Or download fresh theme copy ```

Step 7: Fix PHP Version Compatibility Issues

Resolve errors from PHP version mismatches.

```bash # Check current PHP version: php -v

# Check what PHP version WordPress requires: # WordPress 6.x requires PHP 7.4+

# Check plugin requirements: grep -r "Requires PHP" wp-content/plugins/*/readme.txt

# Common PHP 7 to 8 incompatibilities: # 1. Removed functions: create_function(), each() # 2. Changed behavior: magic quotes removed # 3. Stricter type handling

# Find deprecated function usage: grep -r "create_function|each(" wp-content/plugins/

# If plugin uses deprecated functions: # Option 1: Update plugin to latest version # Option 2: Find alternative plugin # Option 3: Patch plugin code:

# Example fix for create_function: # Old: # add_action('init', create_function('', 'do_something();')); # New: # add_action('init', function() { do_something(); });

# Patch the file: sed -i 's/create_function/function/g' wp-content/plugins/plugin/file.php

# For each() usage: # Old: while(list($key, $value) = each($array)) # New: foreach($array as $key => $value)

# Test after patches

# If can't fix, downgrade PHP: sudo update-alternatives --config php # Select older PHP version

# Or use .htaccess to use different PHP: AddHandler application/x-httpd-php74 .php ```

Step 8: Repair Corrupted WordPress Core Files

Fix corrupted or missing WordPress core files.

```bash # Check WordPress version: grep "wp_version" wp-includes/version.php

# Download matching WordPress version: cd /tmp wget https://wordpress.org/wordpress-6.4.3.tar.gz # Adjust version tar xzf wordpress-6.4.3.tar.gz

# Backup current WordPress: cp -r /var/www/wordpress /var/www/wordpress.backup

# Replace core files (NOT wp-content): cd wordpress rm -rf wp-content cp -r * /var/www/wordpress/

# Or manually copy specific corrupted files: # If error mentions wp-includes/file.php: cp wp-includes/file.php /var/www/wordpress/wp-includes/

# Verify core files are intact: cd /var/www/wordpress find . -name "*.php" -exec php -l {} \; 2>&1 | grep -v "No syntax errors"

# This will show any PHP syntax errors

# Test site

# Verify WordPress database is intact: wp core verify-checksums 2>/dev/null || echo "WP-CLI not available, manual verification needed"

# Repair database if needed: wp db repair ```

Step 9: Recover via WordPress Recovery Mode

Use WordPress 5.2+ built-in recovery features.

```bash # WordPress 5.2+ has recovery mode

# Check email for recovery link: # Subject: [Your Site] Your Site is Experiencing a Technical Issue # Click the link in the email

# Or manually enter recovery mode: # Add to wp-config.php: define( 'WP_RECOVERY_MODE_EMAIL', 'your-email@example.com' );

# Visit: https://example.com/wp-login.php?action=enter_recovery_mode

# Or via WP-CLI: wp recovery-mode

# In recovery mode: # 1. WordPress will identify the problem plugin/theme # 2. You can pause (deactivate) the problematic extension # 3. Your site will work again while you fix the issue

# Check paused plugins: wp option get wp_paused_plugins wp option get wp_paused_themes

# Resume after fix: wp recovery-mode unpause-plugin plugin-name

# Delete recovery mode link after use: wp option delete recovery_mode_hash ```

Step 10: Set Up Error Monitoring and Prevention

Create monitoring and backup procedures.

```bash # Create WordPress health check script: cat > /usr/local/bin/check-wordpress.sh << 'EOF' #!/bin/bash # WordPress Health Check

SITE_URL="https://example.com" LOG_FILE="/var/log/wordpress-health.log" ALERT_EMAIL="ops@company.com"

# Check if site responds HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" $SITE_URL)

if [ "$HTTP_STATUS" != "200" ]; then echo "$(date): WordPress returned HTTP $HTTP_STATUS" >> $LOG_FILE

# Check for fatal errors in debug log if [ -f "/var/www/wordpress/wp-content/debug.log" ]; then RECENT_ERRORS=$(tail -50 /var/www/wordpress/wp-content/debug.log | grep -i "fatal|error") if [ -n "$RECENT_ERRORS" ]; then echo "$(date): Fatal errors detected:" >> $LOG_FILE echo "$RECENT_ERRORS" >> $LOG_FILE

# Alert echo -e "WordPress fatal errors detected:\n\n$RECENT_ERRORS" | \ mail -s "WordPress Error Alert" $ALERT_EMAIL fi fi

exit 1 fi

# Check PHP-FPM is running if ! systemctl is-active --quiet php8.2-fpm; then echo "$(date): PHP-FPM is not running!" >> $LOG_FILE systemctl start php8.2-fpm fi

# Check for plugin updates needed cd /var/www/wordpress wp plugin list --status=active --field=name,update_version 2>/dev/null | while read line; do if [ -n "$line" ]; then echo "$(date): Plugin update available: $line" >> $LOG_FILE fi done

echo "$(date): WordPress is healthy" >> $LOG_FILE exit 0 EOF

chmod +x /usr/local/bin/check-wordpress.sh

# Add to cron: (crontab -l; echo "*/5 * * * * /usr/local/bin/check-wordpress.sh") | crontab -

# Create automatic backup before updates: cat > /usr/local/bin/wordpress-backup.sh << 'EOF' #!/bin/bash BACKUP_DIR="/var/backups/wordpress" DATE=$(date +%Y%m%d-%H%M%S) SITE_DIR="/var/www/wordpress"

mkdir -p $BACKUP_DIR

# Backup files (excluding uploads for size) tar -czf $BACKUP_DIR/wordpress-files-$DATE.tar.gz \ --exclude="$SITE_DIR/wp-content/uploads" \ $SITE_DIR

# Backup database wp db export $BACKUP_DIR/wordpress-db-$DATE.sql --allow-root

# Keep only last 7 backups find $BACKUP_DIR -type f -mtime +7 -delete

echo "$(date): Backup completed" >> /var/log/wordpress-backup.log EOF

chmod +x /usr/local/bin/wordpress-backup.sh

# Add to daily cron: (crontab -l; echo "0 2 * * * /usr/local/bin/wordpress-backup.sh") | crontab - ```

Checklist for Fixing WordPress Fatal Errors

StepActionCommandStatus
1Enable debuggingEdit wp-config.php, set WP_DEBUG true
2Disable all pluginsRename plugins folder or use DB
3Switch to default themeChange theme in DB or rename folder
4Fix memory limitAdd WP_MEMORY_LIMIT to wp-config.php
5Fix plugin-specific errorsUpdate or replace problematic plugin
6Fix theme functions.phpCheck syntax, comment out problem code
7Fix PHP compatibilityUpdate PHP or patch deprecated code
8Repair core filesDownload and replace WordPress core
9Use recovery modeAccess via email link or wp-login.php
10Set up monitoringCreate health check script

Verify the Fix

After fixing WordPress fatal errors, verify everything works:

```bash # 1. Site loads without errors curl -I https://example.com/ # Should return HTTP 200

# 2. No errors in debug log tail -50 wp-content/debug.log | grep -i error # Should be empty or only warnings

# 3. Admin dashboard accessible curl -I https://example.com/wp-admin/ # Should return HTTP 200 or redirect to login

# 4. All plugins active wp plugin list --status=active # Should show expected plugins

# 5. Theme is active wp theme list --status=active # Should show your theme

# 6. PHP memory adequate php -i | grep memory_limit # Should show 512M or more

# 7. No fatal errors in PHP log tail -100 /var/log/php-fpm/error.log | grep -i fatal # Should be empty

# 8. Pages load correctly curl -s https://example.com/ | grep -i "error|fatal" # Should return empty

# 9. WooCommerce works (if applicable) wp wc tool run clear_transients --allow-root

# 10. Health check passes /usr/local/bin/check-wordpress.sh # Exit code 0 ```

  • [Fix WordPress White Screen of Death](/articles/fix-wordpress-white-screen-death) - WSOD troubleshooting
  • [Fix WordPress 500 Internal Server Error](/articles/fix-wordpress-500-internal-server-error) - Server errors
  • [Fix WordPress Plugin Conflict](/articles/fix-wordpress-plugin-conflict) - Plugin conflicts
  • [Fix PHP Memory Limit Exhausted](/articles/fix-php-memory-limit-exhausted) - Memory issues
  • [Fix WordPress Database Connection Error](/articles/fix-wordpress-database-connection-error) - DB errors
  • [Fix WordPress Update Failed](/articles/fix-wordpress-update-failed) - Update issues
  • [Fix PHP Composer Dependency Conflict](/articles/fix-php-composer-dependency-conflict) - PHP dependency issues