WordPress, while user-friendly, can sometimes throw up errors that leave even experienced users scratching their heads. Understanding the most common ones and knowing how to troubleshoot them can save you a lot of time and frustration.
Here’s a breakdown of the most common WordPress errors and how to fix them:
1. White Screen of Death (WSoD)
This is one of the most dreaded errors, as it leaves you with a completely blank white screen with no error message, making it difficult to diagnose.
Common Causes:
- Plugin or Theme Conflict: Most often, a plugin or theme is causing a conflict with another plugin/theme or the WordPress core.
- PHP Memory Limit Exhaustion: Your website has run out of allocated memory to perform a task.
- Corrupt Files: Core WordPress files might be corrupted.
How to Fix:
- Deactivate All Plugins (via FTP): This is the most common fix. Access your site via FTP (FileZilla is a popular client) or your hosting’s file manager. If your site comes back, reactivate plugins one by one through your WordPress dashboard to find the culprit.
- Switch to a Default Theme (via FTP): If deactivating plugins doesn’t work, rename your active theme folder in wp-content/themes (e.g., mytheme-disabled). This will force WordPress to activate a default theme (like Twenty Twenty-Four). If your site recovers, the issue is with your theme.
- Increase PHP Memory Limit:
- wp-config.php: Add define(‘WP_MEMORY_LIMIT’, ‘256M’); just above the /* That’s all, stop editing! Happy publishing. */ line in your wp-config.php file (located in the root directory).
- php.ini: If you have access, create or edit a php.ini file in your root directory and add memory_limit = 256M;.
- .htaccess: In your .htaccess file (in the root directory), add php_value memory_limit 256M.
- Contact Your Host: If none of these work, your host might have stricter limits, and you’ll need to ask them to increase your PHP memory limit.
- Enable Debugging: If the WSoD persists, enable WordPress debugging to get error messages. Add define(‘WP_DEBUG’, true); and define(‘WP_DEBUG_LOG’, true); to your wp-config.php file. Remember to set WP_DEBUG back to false when you’re done.
2. Error Establishing a Database Connection
Common Causes:
- Incorrect Database Credentials: The most frequent cause – wrong database name, username, password, or host in your wp-config.php file.
- Corrupted Database: The database itself might be corrupted.
- Database Server Issues: The database server might be down or overloaded (often a hosting issue).
- Corrupted WordPress Core Files: Less common, but possible.
How to Fix:
- Check Database Credentials (wp-config.php):
- Access wp-config.php via FTP or file manager.
- Verify DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST against the actual credentials provided by your hosting provider (usually found in your hosting control panel like cPanel or phpMyAdmin). DB_HOST is usually localhost, but some hosts use a different value.
- Repair the Database:
- Happy publishing. */ line.
- Then, visit yourwebsite.com/wp-admin/maint/repair.php in your browser. You’ll see options to repair or optimize your database.
- Important: Remove define(‘WP_ALLOW_REPAIR’, true); from wp-config.php after repairing for security.
- Check Database Server Status: Contact your hosting provider. They can tell you if there are any issues with their database servers or if your database is overloaded.
- Repair Corrupted WordPress Files: If your WordPress core files are damaged, it can prevent database connection. Extract it and upload the wp-admin and wp-includes folders, as well as the files in the root directory (excluding wp-content), overwriting the existing ones on your server. Do NOT upload the wp-content folder from the fresh install, as it contains your themes, plugins, and uploads.
3. Internal Server Error (500 Error)
This is a generic error message from your server indicating something went wrong, but it can’t be more specific.
Common Causes:
- Corrupted .htaccess file: A common culprit, especially after plugin installations or permalink changes.
- PHP Memory Limit: Similar to WSoD, insufficient memory can cause this.
- Plugin or Theme Conflict: Another frequent reason.
- Incorrect File Permissions: Incorrect file permissions on your server can prevent scripts from running.
- Outdated PHP Version: Your site might be running on an old PHP version incompatible with your current WordPress, themes, or plugins.
How to Fix:
- Check .htaccess File:
- Access your site via FTP or file manager.
- Rename it to something like htaccess_old.
- Try accessing your site. If it works, go to Settings > Permalinks in your WordPress dashboard and click “Save Changes” (without making any actual changes) to generate a new .htaccess file.
- Increase PHP Memory Limit: (See instructions for WSoD above).
- Deactivate All Plugins: (See instructions for WSoD above).
- Switch to a Default Theme: (See instructions for WSoD above).
- Check File Permissions: Ensure your file permissions are set correctly:
- Folders: 755
- Files: 644
- wp-config.php: 400 or 440
- You can usually change permissions via your FTP client or hosting control panel.
- Update PHP Version: Check with your hosting provider to ensure your site is running a recommended PHP version (e.g., PHP 7.4 or higher). You can usually change this in your hosting control panel.
- Re-upload WordPress Core Files: (See instructions for “Error Establishing a Database Connection” above).
4. Syntax Error (Parse Error)
This occurs when there’s a mistake in your site’s code, usually in a theme or plugin file, preventing WordPress from parsing it correctly.
Common Causes:
- Typo in Code: A missing semicolon, an unclosed bracket, or an incorrect character in functions.php or other code files.
- Copy-Pasting Code Incorrectly: When adding snippets from tutorials.
How to Fix:
- Locate the Error: The error message will usually tell you the file path and line number where the error occurred (e.g., Parse error: syntax error, unexpected ‘)’ in /public_html/wp-content/themes/yourtheme/functions.php on line 123).
- Access the File (via FTP): Use FTP or your hosting’s file manager to navigate to the specified file.
- Correct the Code:
- Undo Recent Changes: If you just added or edited code, undo those changes.
- Look for Missing/Extra Characters: Pay close attention to the line number indicated. Common mistakes include missing semicolons (;), missing closing brackets (}, ), ]), or incorrect quotes.
- Use a Code Editor: If you have one, open the file in a good code editor (like Visual Studio Code or Sublime Text) which provides syntax highlighting and can help spot errors.
- Upload the Corrected File: Save the file and upload it back to your server.
5. 404 Error on Posts/Pages (after permalink change)
This happens when you click on a post or page, and instead of showing the content, it returns a “404 Not Found” error. This is common after migrating a site or changing permalink settings.
Common Causes:
- Corrupted .htaccess file: The rewrite rules that direct traffic to your posts are broken.
- Server Rewrite Module Issues: Less common, but sometimes the server’s Apache mod_rewrite module isn’t enabled.
How to Fix:
- Reset Permalinks:
- Log in to your WordPress dashboard.
- Go to Settings > Permalinks.
- Without changing anything, simply click the “Save Changes” button
- Manually Fix .htaccess: If you can’t access your dashboard, or the above doesn’t work:
- Access your site via FTP or file manager.
- Delete the existing .htaccess file in your root directory.
- Access your site via FTP or file manager.
Create a new .htaccess file and paste the default WordPress permalink rules:
Apache
# 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
- Save and upload the new .htaccess file.
- Check Server Rewrite Module: If the issue persists, contact your hosting provider and ask if the mod_rewrite module is enabled on their server.
6. Connection Timed Out
Common Causes:
- Insufficient PHP Memory Limit or Max Execution Time: The server doesn’t have enough resources or time to complete a script.
- Problematic Plugin or Theme: A poorly coded plugin or theme is consuming too many resources.
- Shared Hosting Resource Limits: On shared hosting, your site might be hitting resource limits.
- DDoS Attack or High Traffic: If your site is experiencing an unusual surge in traffic.
How to Fix:
- Increase PHP Memory Limit and Max Execution Time:
- wp-config.php: Add define(‘WP_MEMORY_LIMIT’, ‘256M’); and set_time_limit(300); (or a higher value if needed) to your wp-config.php file.
- php.ini: Add memory_limit = 256M; and max_execution_time = 300; to your php.ini file.
- .htaccess: Add php_value memory_limit 256M and php_value max_execution_time 300 to your .htaccess file.
- Optimize Your WordPress Database: Use a plugin like WP-Optimize to clean up your database, which can improve performance.
- Improve Hosting Environment: If you’re on cheap shared hosting and consistently experience timeouts, consider upgrading to a more robust hosting plan (e.g., VPS or managed WordPress hosting).
- Check Server Logs: Your hosting provider can help you review server logs, which might reveal the specific process or script causing the timeout.
7. Failed to Update (Core, Plugin, or Theme)
You see an error message when trying to update WordPress, a plugin, or a theme.
Common Causes:
- Connection Issues: Interrupted internet connection or server connectivity.
- File Permissions: Incorrect permissions prevent WordPress from writing new files.
- Memory Exhaustion: Not enough memory to complete the update process.
- Stuck in Maintenance Mode: WordPress can get stuck in maintenance mode during an update.
- Plugin/Theme Conflict: Another plugin or theme interfering with the update process.
How to Fix:
- Clear Browser and WordPress Cache: Clear your browser cache and any caching plugins you might be using.
- Increase PHP Memory Limit: (See WSoD or Connection Timed Out instructions).
- Fix File Permissions: (See Internal Server Error instructions for recommended permissions).
- Deactivate Plugins/Switch Themes: Temporarily deactivate all plugins and switch to a default theme, then try the update again.
- Manual Update: If all else fails, perform a manual update:
- WordPress Core: Download the latest WordPress version, extract it, and upload the wp-admin and wp-includes folders, and all files in the root (except wp-content) via FTP, overwriting existing ones.
- Plugins/Themes: Download the latest version of the specific plugin/theme, delete the old version (via FTP, making sure to back up any custom code), and then upload the new version.
8. HTTP Error When Uploading Images.
Common Causes:
- Insufficient PHP Memory Limit: The server doesn’t have enough memory to process the image upload.
- PHP Configuration Issues: Problems with PHP libraries used for image processing (GD Library or ImageMagick).
- Incorrect File Permissions: The uploads folder might not have the correct permissions.
- Server-Side Issues: Temporary server glitches, high server load.
- Conflicting Plugins/Themes: Especially image optimization plugins or security plugins.
How to Fix:
- Refresh the Page: Sometimes it’s a temporary glitch. Try refreshing the page and re-uploading.
- Increase PHP Memory Limit: (See WSoD or Connection Timed Out instructions).
- Deactivate Plugins/Switch Themes: Temporarily deactivate image optimization plugins, security plugins, and then all other plugins. Also, try switching to a default theme.
Change Image Editor Library (Advanced): WordPress uses either GD Library or ImageMagick for image processing. Sometimes, switching can help. Add the following to your functions.php file (or a site-specific plugin):
PHP
add_filter( ‘wp_image_editors’, ‘change_wp_image_editor_sequence’ );
function change_wp_image_editor_sequence( $editors )
- (You can reverse the order to try Imagick first).
- Optimize Image Size: If you’re uploading very large images, try resizing and compressing them before uploading.
- Check PHP Version: Ensure you are using a compatible and up-to-date PHP version.
- Contact Hosting Provider: If none of the above works, it could be a server-side issue. Your host can check error logs and server configuration.
General Troubleshooting Tips for Any WordPress Error:
- Backup Your Site FIRST: Before attempting any fixes, always create a complete backup of your WordPress files and database. This is your safety net!
- Enable WordPress Debugging: As mentioned, define(‘WP_DEBUG’, true); in wp-config.php will often show you specific error messages that help diagnose the problem.
- Check Server Logs: Your hosting provider’s control panel (cPanel, Plesk, etc.) usually offers access to error logs (Apache error logs, PHP error logs). These logs can contain valuable clues.
- Deactivate Plugins/Themes Systematically: This is a golden rule for diagnosing conflicts. Deactivate all, then reactivate one by one.
- Use a Staging Environment: For critical sites, make changes and test them on a staging (development) environment before applying them to your live site.
- Stay Updated: Keeping WordPress core, themes, and plugins updated is crucial for security and compatibility, preventing many errors before they occur.
- Consult Your Hosting Provider: If you’re unsure or can’t resolve the issue, your hosting support team is often the best resource, especially for server-related problems.
- Search Online: When you get a specific error message, copy and paste it into a search engine.
By systematically troubleshooting and understanding these common errors, you can effectively maintain the health and functionality of your WordPress website.