How to Fix Common WordPress Errors: Complete Troubleshooting Guide

Step-by-step solutions to fix the most common WordPress errors including white screen of death, 500 errors, database connection issues, and more.

WordPress Expert
15 min
#errors#troubleshooting#debug#fix#wordpress issues
How to Fix Common WordPress Errors: Complete Troubleshooting Guide - Featured image for Troubleshooting guide

WordPress errors can be frustrating, especially when they prevent you from accessing your site. This comprehensive guide covers the most common WordPress errors and provides step-by-step solutions to fix them quickly.

Understanding WordPress Errors

WordPress errors typically fall into these categories:

  • Server Errors (500, 503, 504)
  • Database Errors (Connection issues, corruption)
  • PHP Errors (Memory limit, syntax errors)
  • Plugin/Theme Conflicts
  • Permission Errors
  • White Screen of Death
  • Update Failures

Essential Tools for Troubleshooting

Enable WordPress Debug Mode

// Add to wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);

// Debug log location: wp-content/debug.log

Access via FTP/SFTP

Recommended FTP Clients:

  • FileZilla (Free, cross-platform)
  • Cyberduck (Free, Mac/Windows)
  • WinSCP (Free, Windows)

Server Access:

# SSH access credentials
Host: your-server.com
Port: 22
Username: your-username
Password: your-password

Backup Before Troubleshooting

# Always create a backup first
# Via command line (if you have SSH access):
tar -czf backup-$(date +%Y%m%d).tar.gz /path/to/wordpress

# Or use plugins:
# - UpdraftPlus
# - Duplicator
# - BackupBuddy

Error 1: White Screen of Death (WSoD)

The infamous WordPress white screen with no error message.

Causes

  • Plugin conflict
  • Theme conflict
  • Memory limit exceeded
  • PHP fatal error
  • Corrupted core files

Solution 1: Increase Memory Limit

// wp-config.php
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');
// php.ini (if you have access)
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

Solution 2: Disable All Plugins

# Via FTP: Rename the plugins folder
wp-content/plugins → wp-content/plugins-disabled

# Via SSH:
cd /path/to/wordpress/wp-content
mv plugins plugins-disabled
// Check if site loads
// If it does, rename folder back and disable plugins one by one
// Via FTP: Rename individual plugin folders to identify the culprit

Solution 3: Switch to Default Theme

# Via FTP: Rename your theme folder
wp-content/themes/your-theme → wp-content/themes/your-theme-disabled

# WordPress will automatically activate a default theme
// Via database (if you can access phpMyAdmin):
UPDATE wp_options 
SET option_value = 'twentytwentyfour' 
WHERE option_name = 'template' OR option_name = 'stylesheet';

Solution 4: Enable Debug Mode

// wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', true);

// Reload the page and check for error messages
// Check wp-content/debug.log for detailed errors

Solution 5: Replace Core Files

# Download fresh WordPress files
wget https://wordpress.org/latest.zip

# Extract and replace (preserving wp-config.php and wp-content)
unzip latest.zip
rsync -av wordpress/ /path/to/your/site/ --exclude wp-config.php --exclude wp-content

# Or via WP-CLI:
wp core download --force --skip-content

Error 2: Error Establishing Database Connection

This error means WordPress can't connect to your MySQL database.

Causes

  • Incorrect database credentials
  • Database server down
  • Corrupted database
  • Too many connections
  • Database server changed

Solution 1: Verify Database Credentials

// wp-config.php - Check these values
define('DB_NAME', 'database_name');     // Database name
define('DB_USER', 'username');          // Database username
define('DB_PASSWORD', 'password');      // Database password
define('DB_HOST', 'localhost');         // Usually 'localhost'

// Common DB_HOST variations:
// - localhost
// - 127.0.0.1
// - localhost:3306
// - mysql.example.com (for remote databases)

Solution 2: Test Database Connection

// Create test-db.php in root directory
<?php
$host = 'localhost';
$user = 'your_username';
$pass = 'your_password';
$db = 'your_database';

$connection = mysqli_connect($host, $user, $pass, $db);

if ($connection) {
    echo "Database connection successful!";
    mysqli_close($connection);
} else {
    echo "Connection failed: " . mysqli_connect_error();
}
?>
# Access via browser: http://yoursite.com/test-db.php
# Delete the file after testing for security

Solution 3: Repair Database

// wp-config.php - Add above "That's all, stop editing!"
define('WP_ALLOW_REPAIR', true);
# Access repair page:
http://yoursite.com/wp-admin/maint/repair.php

# After repair, REMOVE the line from wp-config.php

Solution 4: Check Database Server

# SSH into server and check MySQL status
systemctl status mysql
# or
systemctl status mariadb

# Restart MySQL if needed
systemctl restart mysql

Solution 5: Increase Database Resources

-- Check current connections
SHOW STATUS WHERE variable_name = 'Threads_connected';
SHOW VARIABLES WHERE variable_name = 'max_connections';

-- Increase max connections (in my.cnf)
-- [mysqld]
-- max_connections = 200

Error 3: Internal Server Error (500)

Generic error that can have multiple causes.

Causes

  • Corrupted .htaccess file
  • PHP memory limit
  • Plugin conflict
  • Theme conflict
  • Corrupted core files

Solution 1: Check .htaccess File

# Via FTP: Rename .htaccess
.htaccess → .htaccess-backup
# If site works, regenerate .htaccess
# Go to Settings → Permalinks and click "Save Changes"

# Default WordPress .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Solution 2: Increase PHP Limits

// .htaccess method
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
php_value memory_limit 256M
# php.ini method (better)
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_time = 300

Solution 3: Check Error Logs

# Check server error logs
# Location varies by hosting:
# - /var/log/apache2/error.log
# - /var/log/nginx/error.log
# - Check cPanel Error Log
# - Check hosting control panel

# View last 50 lines:
tail -50 /var/log/apache2/error.log

Solution 4: Disable Plugins/Themes

# Same as WSoD solution - rename plugins folder
# Check if error persists
# Enable plugins one by one to find the culprit

Error 4: 404 Error - Page Not Found

Pages or posts return 404 even though they exist.

Causes

  • Corrupted .htaccess
  • Permalink structure issues
  • Incorrect rewrite rules
  • Server configuration
# WordPress Admin:
1. Go to Settings → Permalinks
2. Note your current permalink structure
3. Click "Save Changes" without changing anything
4. This regenerates rewrite rules

Solution 2: Check .htaccess

# Ensure .htaccess has correct permissions
chmod 644 .htaccess

# Verify WordPress rewrite rules are present
# Should contain:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Solution 3: Check Apache mod_rewrite

# Ensure mod_rewrite is enabled (Ubuntu/Debian)
sudo a2enmod rewrite
sudo systemctl restart apache2

# Check if enabled:
apache2ctl -M | grep rewrite
# Should output: rewrite_module (shared)

Solution 4: Update WordPress Database

# Via WP-CLI:
wp core update-db

# Manual database update:
# Access: http://yoursite.com/wp-admin/upgrade.php

Error 5: "Sorry, you are not allowed to access this page"

Permission error when accessing admin areas.

Causes

  • Lost administrator role
  • Plugin/theme interference
  • Corrupted user meta
  • Database prefix mismatch

Solution 1: Reset User Role via Database

-- Access phpMyAdmin
-- Find your user ID:
SELECT ID, user_login, user_email FROM wp_users;

-- Check current capabilities:
SELECT * FROM wp_usermeta WHERE user_id = YOUR_USER_ID AND meta_key = 'wp_capabilities';

-- Reset to administrator:
UPDATE wp_usermeta 
SET meta_value = 'a:1:{s:13:"administrator";b:1;}' 
WHERE user_id = YOUR_USER_ID 
AND meta_key = 'wp_capabilities';

-- Set user level:
UPDATE wp_usermeta 
SET meta_value = '10' 
WHERE user_id = YOUR_USER_ID 
AND meta_key = 'wp_user_level';

Solution 2: Check Database Prefix

// wp-config.php
$table_prefix = 'wp_'; // Should match your actual database prefix

// If different, update:
$table_prefix = 'custom_prefix_'; // Match your actual prefix
-- Check actual prefix in database:
SHOW TABLES;
-- Tables should start with 'wp_' or your custom prefix

Solution 3: Create New Admin User

// Add to functions.php temporarily
function create_emergency_admin() {
    $username = 'emergency_admin';
    $password = 'strong_password_here';
    $email = 'admin@yoursite.com';
    
    if (!username_exists($username) && !email_exists($email)) {
        $user_id = wp_create_user($username, $password, $email);
        $user = get_user_by('id', $user_id);
        $user->set_role('administrator');
        echo 'Emergency admin created!';
    }
}
add_action('init', 'create_emergency_admin');

// Visit site, then REMOVE this code immediately

Error 6: "The uploaded file exceeds the upload_max_filesize directive"

Can't upload files due to size restrictions.

Causes

  • PHP upload_max_filesize limit
  • post_max_size limit
  • Server restrictions
  • Nginx client_max_body_size

Solution 1: Increase via php.ini

# php.ini (best method)
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256M
max_execution_time = 300

Solution 2: Increase via .htaccess

# .htaccess (Apache only)
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value memory_limit 256M
php_value max_execution_time 300

Solution 3: Increase via wp-config.php

// wp-config.php
@ini_set('upload_max_filesize', '64M');
@ini_set('post_max_size', '64M');
@ini_set('memory_limit', '256M');
@ini_set('max_execution_time', '300');

Solution 4: Nginx Configuration

# nginx.conf or site configuration
http {
    client_max_body_size 64M;
}

# Or in server block:
server {
    client_max_body_size 64M;
}

# Restart Nginx:
sudo systemctl restart nginx

Error 7: "Maximum execution time exceeded"

Script runs too long and times out.

Causes

  • Large import/export operations
  • Slow server
  • Resource-intensive plugins
  • Large media uploads

Solution 1: Increase PHP max_execution_time

# php.ini
max_execution_time = 300
max_input_time = 300
# .htaccess
php_value max_execution_time 300
php_value max_input_time 300
// wp-config.php
@ini_set('max_execution_time', '300');

// Or in specific script:
set_time_limit(300);

Solution 2: Split Large Operations

// For large imports, process in batches
function import_in_batches() {
    $batch_size = 50;
    $offset = get_option('import_offset', 0);
    
    // Process batch
    // ...
    
    // Update offset
    update_option('import_offset', $offset + $batch_size);
    
    // Schedule next batch
    if ($more_to_process) {
        wp_schedule_single_event(time() + 10, 'process_next_batch');
    }
}

Error 8: "Error: Cookies are blocked or not supported"

Can't log in due to cookie issues.

Causes

  • Browser blocking cookies
  • Incorrect WordPress URL settings
  • SSL/HTTPS issues
  • Plugin interference

Solution 1: Clear Browser Cookies

# Instructions for users:
1. Clear browser cookies for your domain
2. Clear browser cache
3. Try logging in again
4. Try different browser/incognito mode

Solution 2: Fix WordPress URL

// wp-config.php - Force correct URLs
define('WP_HOME', 'https://yoursite.com');
define('WP_SITEURL', 'https://yoursite.com');

// Or via database:
UPDATE wp_options SET option_value = 'https://yoursite.com' 
WHERE option_name = 'home' OR option_name = 'siteurl';

Solution 3: Check SSL Configuration

// wp-config.php - Force SSL for admin
define('FORCE_SSL_ADMIN', true);

// Force HTTPS
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'on') {
    wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301);
    exit();
}

Error 9: "Syntax error" or "Parse error"

PHP syntax error in code.

Causes

  • Missing semicolons, brackets, or quotes
  • Incorrect function syntax
  • Version compatibility issues
  • Copying code from websites (smart quotes)

Solution 1: Identify the Error

// Error message typically shows:
Parse error: syntax error, unexpected '}' in /path/to/file.php on line 45

// Key information:
// - File path
// - Line number
// - Type of error

Solution 2: Fix via FTP

# Access file via FTP
# Navigate to file path shown in error
# Edit the file and fix the syntax error
# Common issues:
# - Missing semicolon at end of line
# - Unclosed brackets { }
# - Unclosed quotes " "
# - Smart quotes instead of straight quotes

Solution 3: Restore from Backup

# If you can't identify the error:
# Restore the file from backup
# Or re-download the plugin/theme from official source

Solution 4: Common Syntax Fixes

// Wrong (smart quotes from Word/web):
echo "Hello World";

// Right (straight quotes):
echo "Hello World";

// Wrong (missing semicolon):
$var = "value"

// Right:
$var = "value";

// Wrong (unclosed bracket):
function my_function() {
    echo "test";

// Right:
function my_function() {
    echo "test";
}

Error 10: "Are you sure you want to do this?" (Nonce Error)

WordPress security nonce verification failed.

Causes

  • Session expired
  • Plugin/theme nonce issue
  • Caching interfering
  • Security plugin blocking

Solution 1: Reload and Retry

# Simple fix:
1. Refresh the page
2. Try the action again
3. Clear browser cache if needed

Solution 2: Disable Caching Temporarily

// Temporarily disable caching plugins
// Try the action again
// Re-enable caching after

Solution 3: Check Session Configuration

// wp-config.php - Ensure sessions work properly
if (!session_id()) {
    session_start();
}

Troubleshooting Checklist

Quick Diagnostics

  • Enable WordPress debug mode
  • Check error logs (server and WordPress)
  • Test in different browser
  • Clear browser cache and cookies
  • Disable all plugins
  • Switch to default theme
  • Check file permissions
  • Verify database connection
  • Check PHP version compatibility
  • Review recent changes

Common File Permissions

# Correct WordPress file permissions
find /path/to/wordpress -type d -exec chmod 755 {} \;
find /path/to/wordpress -type f -exec chmod 644 {} \;
chmod 600 wp-config.php

# If using suPHP:
chmod 644 .htaccess

Preventive Measures

// Keep WordPress, themes, and plugins updated
// Maintain regular backups
// Use quality hosting
// Monitor error logs regularly
// Test changes on staging site first
// Document all customizations

Need Expert Help?

Troubleshooting WordPress errors can be time-consuming and frustrating. If you need professional assistance to fix your WordPress issues quickly, I'm here to help.

My WordPress Troubleshooting Services

I specialize in fixing:

  • ✅ White screen of death
  • ✅ Database connection errors
  • ✅ 500 Internal server errors
  • ✅ Plugin and theme conflicts
  • ✅ Update failures
  • ✅ Site crashes and performance issues
  • ✅ Security issues and hacks
  • ✅ Custom code errors

Get expert help fast: Fix WordPress Issues & Errors

View my profile: Professional WordPress Developer

I provide fast, reliable fixes for WordPress, Elementor, and WooCommerce with same-day turnaround available.

Conclusion

WordPress errors are common but usually fixable with the right approach. The key is to:

  1. Stay calm - Most errors have simple solutions
  2. Enable debugging - Identify the exact cause
  3. Make backups - Before making changes
  4. Test systematically - Eliminate variables one by one
  5. Document fixes - Remember what worked

Prevention Tips:

  • Keep everything updated
  • Use quality plugins and themes
  • Maintain regular backups
  • Monitor error logs
  • Use staging site for testing
  • Choose reliable hosting

When in doubt, don't hesitate to seek professional help to avoid making the problem worse.

Additional Resources


Experiencing WordPress errors you can't fix? Get professional help on Fiverr and get your site back online fast!

WordPress Expert

WordPress Expert

Expert WordPress & Shopify Developer

Senior full-stack developer with 10+ years experience specializing in WordPress, Shopify, and headless CMS solutions. Delivering custom themes, plugins, e-commerce stores, and scalable web applications.

10+ Years500+ Projects100+ Agencies