Are you working with WordPress? If yes, then you are at the right place!
WordPress is the most popular CMS in the world powering 29% of the global internet. WP is the first choice for millions of people across the globe to create a website, blog or eCommerce sites. It is one of the best platforms to take your business or brand to masses, boost brand identity and increase return on investment.
Besides this, setting up a site on WordPress is exceptionally easy, credit goes to its user-friendly interface.
Although WP is quite easy to use yet there are a few ordinary errors which can make you panic.
However, the good thing is that the WP error you might be dealing with is most likely been settled down by someone before you as WP has a huge community of users at the global level.
In this guide, we will look at 5 of the most common WordPress errors and find the easiest ways to fix them. This way, if you ever encounter any of them, you will be more than ready to deal with them.
So stick to this guide until the end.
Error '403 Forbidden’ in WordPress-
Error ‘403 forbidden’ is one of the most common and dreadful errors in WordPress that can come across at one point or another. Before we know how to fix it, let’s understand what exactly the error 403 forbidden is.
It is an error code which appears when your server doesn’t provide access to a specific page of your website.
This error is usually accompanied by a message i.e. ‘You don’t have permission to access the requested directory’. See the following screenshot.
Generally, this error pops up in the following situations.
- During WordPress installation
- When you’re accessing any page on your site
- While you are accessing your login page or dashboard
Few More Causes of the Error ‘403 forbidden’
One of the primary causes for this error in WP is because of imperfectly installed or configured security plugins. Some of the WP security plugins block IP addresses if they suspect them to be harmful. Another possible reason can be incorrect file permissions on the server and .htaccess file.
In addition to this, sometimes, your WP hosting provider can make fortuitous changes in your server’s settings.
How to Fix It
First of all, we recommend you to create a backup of your entire WP site.
Solution for Error Caused By WP Plugins
- First of all, temporarily deactivate all WP plugins available on your site, including the security plugins.
- Check if it is resolving your issue. If your issue gets resolved, it simply says one of the WP plugins was responsible for this error.
- To find out the plugin responsible for the error, activate all plugins one by one until you don’t reproduce the ‘403 forbidden’ error again.
Solution to Error Caused by .htaccess file-
- First, connect to your site using the file manager or FTP client in cPanel. Now look for the .htaccess file in the root folder.
- Download this .htaccess file to your computer so that later on you can take a fresh backup of it.
- Now delete this file from your server. Access your site and see if the error is resolved. If yes, now you can create a new .htaccess file from your WP admin area.
Solution for Error Caused By File Permission-
If the above-mentioned solutions are not resolving your issue then probably incorrect file permission is responsible for this error.
- Get connected to your site using an FTP client. Go to the root folder, select the folder.
- Do right click and then select file permissions from the menu.
- Your FTP client should display file permissions dialog box like this.
- All files on your WP site must have a file permission of 644 or 640.
- All folders on your site should have a file permission of 744 or 755
You can check these file permissions and write the accurate value for them. Moreover, you can also seek the help of your hosting provider to check if your site has accurate file permissions. A professional web hosting company should not hesitate to provide support for the same.
Find out here some other ways to fix Error 403 in WordPress.
2. Error Establishing a Database Connection in WordPress
As the name indicates, this type of the error arises when WordPress fails to establish a database connection. There can be various reasons for it; some of the common are:
- Database credentials are wrong or have changed.
- Database server is down or corrupted.
How to Fix it
Fix Corrupted file
It is the most common underlying reason for this error.
- Download a fresh copy of your WP from WordPress.org and unzip it on your drive.
- Delete the entire WordPress configuration files and content folders.
- Once all corrupted and infected files are deleted, paste the rest files into your WP root folder with the help of FTP client or File manage.
- It will replace the entire corrupted files responsible for the error.
Change Login Credentials
Sometimes database login credentials stop working for reasons like you have changed your web host or some important information about your database that was not manually updated in a configuration file of your WP.
- To update it manually, you need to open the wp-config file and look for your database login information. You may find it near the top of the file. You may find them with the names given below.
- Database name as-DB_Name
- User Name as DB_user
- Login Password as DB_Password
- Database host as DB_Host
- Go through this information and check if it is correct or not. WP will not connect to the database if any of above values are incorrect.
Here you can read out a complete guide to fix Error Establishing a Database Connection in WordPress.
3. 503 Service Unavailable Error
It is another most common WP error which can become challenging sometimes. It usually occurs when your web server is not receiving a proper response from a PHP script. And this PHP script can be your WP theme, plugin or custom code snippet.
How to Fix It
Deactivate All WordPress Plugins
As said above, the error is caused a PHP script that does not communicate properly with your web server, we can try fixing it by disabling unnecessary PHP scripts.
All your WP plugins are PHP scripts so you can deactivate them.
Since you can’t access your site directly because of the 503 error, you will have to connect to your website through an FTP client or File Manager in cPanel.
Once you’re connected, look for the WP root folder, it will be named as public_html. Open this folder and go to the wp-content directory. Now find the ‘plugins folder’, do right click and rename it. You may give it the name ‘plugins deactivated’ or whatever you like.
Now access your site, see if the error has resolved. You should be able to visit your WP site if the plugin was behind this error. By replacing the name of your WP plugins directory, it automatically deactivates all of your plugins.
Now you need to correct the name of your WP plugins directory back. Change your plugins name back to its actual name i.e. plugin. This way WP will recognize all your old plugins, but they will be inactive by default.
4. Fixing the 502 Bad Gateway Error in WordPress
502 Bad Gateway error happens when some pages, scripts or queries take too much long time to complete and then rejected by the web server. Most of the time, this error gets resolved itself. But if it does not resolve itself within few minutes, you can use the following method to resolve it.
Few common reasons that cause this error.
- Your server is overloaded
- Buggy PHP scripts in your site
- Some technical Issues with your network and router
- Server down
- Browser Cache Overload
How to Fix It
Reload Your Site
Sometimes 502 Bad Gateway error is not as serious as you think. Perhaps your server is overloaded causing this error. You may try refresh button or F5 to reload the web page.
Clear the Cache of Your Browsers
Try to access your site in different browsers. If this error disappears in a new browser and comes back when you access your site through the old browser, it means it is the issue with the cache of your browser.
By clearing your browser cache you can experience fast accessing and loading speed of your site.
Fix the DND Issue
If above methods are not working for you, probably the error is in your DNS settings. Check if your domain is not on the right IP address. If not, you can seek the help of your web host.
5. Resolve ‘500 Internal Server Error’
You may see this error on every page of your WP site if there is an issue with the server supporting your website. Sometimes, the error can be caused by the root directory where your website files are saved.
Some other causes for this error are:
- Corrupted .htaccess file
- Poor plugin installation
- Memory limit issues with PHP, etc.
How to Fix it
Fix Corrupted .htaccess File
First of all, you need to determine whether the bad .htaccess file is the cause of the WP 500 internal server error on your site or not.
For the same, you need to login to WP directory using FTP. Here you need to locate a .htaccess file. Do the right click on it and select ‘Rename.’ Next, rename your .htaccess file to .htaccess_old or something you like.
Now access your site and reload it to check if the error has resolved. Once the error has resolved, you will need to recreate .htaccess file which you can simply do by login to your WP admin dashboard-> Settings-> permalinks.
Fix PHP Memory LImit Issue-
As said before, PHP memory limit can also be a reason for this error, you should consider improving the PHP memory limit of your WordPress site which can be done by editing wp-config.php file available in WP directory.
Follow the steps below:
- Go to your WP directory and download the wp-config.php file.
- Open this file in NotePad++ and add the following code just above the line that says /* That's all, stop editing! Happy blogging. */ :
See the snapshot below for the code.
This code will command WP to enhance the memory limit of PHP to 300 MB.
- Next, save these changes and upload it to WP directory.
Without a doubt, WP is a strong platform, but like any great software it may encounter some errors. We hope you learned how to fix these errors in this tutorial.