How To Fix Common WordPress Errors
WordPress is a platform that even non-technical people can set up and start managing without much hassle. However, akin to other web technologies and CMS’s out there, WordPress is also prone to errors. These WordPress errors are triggered due to several reasons, and if you don’t diagnose and troubleshoot them within time, it can cause serious damage to your business.
While services like managed WordPress hosting can help you avoid most of these errors, it’s still important to know how to fix them manually should your WordPress website run into strife.
Hence, in this guide, we will be discussing ten common WordPress errors and how to fix them in the most effective way.
- 500 Internal Server Error
- Error Establishing a Database Connection
- The White Screen of Death
- Syntax Error
- Image Upload Issue
- Locked out from WordPress Admin
- 403 Forbidden Error
- Mixed Content Error in WordPress
- 502 Bad Gateway Error
- Connection Timed Out
#1. 500 Internal Server Error
An internal server error can occur due to several reasons but the error itself does not tell much about what triggered it. Usually, though, it occurs due to bad themes or plugin files, or due to a corrupt .htaccess file.
Fixing this error is simple. Simply log into your File Manager if you’re using cPanel hosting, or access your WordPress files using an FTP client. Rename the .htaccess file to something like .htaccess_old.
After renaming the file, try getting back to your site, and if you succeed, then you have fixed the error. To generate a new .htaccess file, log into your WordPress admin and go to Settings → Permalinks.
Without making any changes, click on the ‘Save Changes’ button. This will create a new .htaccess file.
If this method does not work then you need to increase the PHP memory limit. To do so, go back to your File Manager or FTP and access the wp-config.php file.
Open the file in a text editor and insert the following line of code:
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
Save the file and upload it back to your server. This will increase the PHP memory limit and will fix the Internal Server Error.
#2. Error Establishing a Database Connection
As the name suggests, this error occurs when the server is unable to establish a connection with your WordPress site’s database. The error in connection with the database could be due to the following reasons:
- Corrupt database.
- Incorrect database credentials.
- Unresponsive database server.
Before proceeding with any fix, make sure to check both the front-end and the back-end of your WordPress site. If you’re able to access either, then the first thing you can do to resolve this error is to repair the database. To do so, simply add the following line of code in your wp-config.php file:
Save the file and upload it back to the server. Now you may visit the maintenance page by visiting this URL: http://www.mywpsite.com/wp-admin/maint/repair.php
Click on ‘Repair Database’ to initiate the process from this window. Once the database is repaired, revisit your WordPress site to check if the error is gone or not.
Note: Make sure to remove the code as this is accessible by logged out users as well.
If repairing the database does not work then try fixing the database credentials. Simply access your WordPress configuration file (wp-config.php) and check for database host, database username, and database password. Check this information and apply the correction if required.
Save and upload the file back to the server. Now access your website and if you are lucky you will not see the error.
If none of the above methods work, then it’s possible that the database server is either unresponsive or is too busy handling requests from other websites (in case of shared hosting). At this point, pick up the phone and talk to your hosting provider about the problem.
#3. The White Screen of Death
The White Screen of Death (WSoD) error in WordPress is when there’s no display of any information on the screen and it’s a bit tricky to troubleshoot this error. The WSoD error can occur due to the following reasons:
- Server Unavailability: First off, check if the server is available or not. Sometimes, you see the White Screen of Death on your WordPress site due to an unavailable server. You may check this by running a test on an online tool like isthiswebsitedown.
- Caching Issues: Sometimes the problem only exists for you. Clearing the cache for that particular website on your browser can do the trick. You can easily do this by going to the settings of your web browser.
- Memory Exhaustion: If the above-mentioned methods do not fix the White Screen of Death error then it is possible that you do not have enough memory for the proper execution of PHP. This can be increased from the wp-config.php
Simply open the file in a text editor and add the following line of code:
The line of code above will increase the memory from 64 MB to 128 MB. Now save the file and upload it back to the server.
- Corrupted Themes and Plugins: Faulty themes and plugins can also cause the WSoD error. If you can access the WordPress back-end then fixing this is straightforward. You need to disable all the plugins and if you notice that the error is gone then start re-activating them one-by-one.
In case you are unable to access the back-end as well then you need to access the themes and plugins folder ether via cPanel or via an FTP client. You can disable them all by renaming the folder and then reactivating them once you re-gain access to the WordPress dashboard.
- Syntax Errors: Finally, check for any syntax errors in the code you might have added recently. It’s quite possible that the error occurred due to recent changes inside the .php file. Therefore, it’s important to look for any syntax errors or talk to the developer who is working on your WordPress site.
#4. Syntax Error
There is no defined recipe to fix a syntax error which mostly occurs due to a developer’s mistake. If you know where this error exists, you can fix it easily, of course. The best way to troubleshoot the error is to refer to the log file.
You can also enable debug mode inside WordPress. Search for the following line of code inside the wp-config.php file:
define (‘WP_DEBUG’, false)
And change it to define (‘WP_DEBUG’, true)
Save the changes and upload the updated file. Now return to your WordPress site, refresh it, and you will notice that the error message pointing to the line number where the syntax error exists is displayed.
Similarly, you can also use debugging tools like:
- JS Fiddle.
- Cloud 9.
- JS Bin, etc.
#5. Image Upload Issue
Sometimes WordPress does not let you upload an image from the back-end, which happens due to an inaccurate directory or file permission. Fixing this is simple as well.
Access your WordPress website folder using FTP. Go to wp-content → uploads → File permissions.
This will open a new window where you need to specify the right file permission value.
Input a value of 744 for the upload directory and all the subdirectories within and apply changes to save the new value.
#6. Locked out from WordPress Admin
If you’re unable to access the WordPress admin area then you need to check for a series of issues. If you see just a plain white screen then start troubleshooting for White Screen of Death error.
If you can see the admin area but are unable to login then check for the password. If you are certain about the password and are still unable to login then try resetting it. If you do not get the password reset email then chances are somebody has changed it and now you need to reset it using phpMyAdmin.
Other issues include syntax errors, server unavailability, unresponsive database or privileges issues.
#7. 403 Forbidden Error
This error might occur when a specific page does not get permission from the server. When this happens, it does not allow the page to display its content. The first thing you may try is deactivating all the plugins. If the error is gone then re-activate them one-by-one.
Next, you can fix this by updating the permalinks inside your WordPress site.
To do so, log into your WordPress dashboard and go to Settings → Permalinks. Here, click on the ‘Save changes’ button to update the permalinks.
If that too does not fix the issue then you need to fix the .htaccess file. Access the WordPress folder using FTP, make a copy of your existing .htaccess file, remove the file from the location and refresh your site. If the error is gone then you need to generate a new .htaccess file.
To do so, go to the Settings tab inside your WordPress dashboard, navigate to Permalinks and just click on the ‘Save changes’ button. This will generate a new .htaccess file.
#8. Mixed Content Error in WordPress
This error does not stop your WordPress site but when you inspect the site inside chrome or any other website testing tool, it will show the error of Mixed Content. It happens when a page contains a mixture of both HTTP and HTTPS content.
This can easily be fixed with a plugin. Log into your WordPress dashboard and download Really Simple SSL plugin.
Install and activate the plugin to fix the Mixed Content error.
#9. 502 Bad Gateway Error
Sometimes when you browse a website you see a screen displaying 502 Bad Gateway Error. It happens when the server is unable to respond or takes too long to respond to the user’s request. The server can get unresponsive or slow due to various reasons like memory issues, low resource allocation, bad hardware, and software issues, etc.
Sometimes, just reloading the web page works as the server you are requesting to was temporarily unavailable due to high traffic surges. Another thing you can try is clearing the browser cache. Nowadays, most websites use browser caching for enhanced user-experience. Therefore, it’s possible that you’re looking at a cached page.
Similarly, you need to update the themes and plugins. You can do this either via cPanel or FTP. If you’re still facing the issue, then you need to check your WordPress theme.
#10. Connection Timed Out
This happens when your website is unable to respond to your request after trying many times. Like a 502 bad Gateway Error, this error also occurs due to the unavailability of the server resources. It is common in shared hosting where several websites are hosted on a single server.
Your WordPress site times out on the user when the website is accommodating high traffic or when the server is unresponsive due to some malware, hardware crashes, or corrupt software.
It is recommended that you choose optimized WordPress hosting if you are serious about the performance of your website and if you want to avoid errors like Connection Timed Out.
In this article, we discussed the 10 most common WordPress errors and learned how to troubleshoot these errors. The key to resolving these issues in a timely manner is to understand the possible causes and to take effective measures accordingly.