Experiencing WordPress errors is a common situation for many WordPress users. However, for most beginners, it can be quite scary to run into any WordPress issues if you don’t know how to fix them.
WordPress is undoubtedly the most popular content management system (CMS) with a lot of useful features and great security. But still, issues like WordPress errors and glitches are unavoidable, no matter how advanced it is.
Fret not. Most of the errors are repairable, meaning you can troubleshoot and solve them on your own.
In this article, you will learn about the top five WordPress errors, how to fix them, and prevent them from showing up again. So, let’s get started!
504 Gateway Timeout
The 504 Gateway error is a common error that occurs when a server that acts as a proxy or gateway does not acquire a well timed response from an upstream server. Thus, the request cannot be completed.
There are several issues that might cause the 504 Gateway Timeout error, such as connectivity problems, Domain Name System (DNS) problems, and an Unresolvable domain. If you are experiencing this 504 gateway error, here are three simple ways to fix it.
Clear Browser’s Cache
Clearing your browser’s cache is the easiest fix you can try. Depending on the browser’s preferences, here is an example of clearing cache using Google Chrome:
- Open Google Chrome.
- Navigate to Customize and Control -> Settings -> Privacy and Security.
- Select Clear Browsing Data.
- Check Cached Images and Files then hit Clear Data.
- Reload the website or press F5 to see if the error is fixed.
Flush DNS
Flushing DNS cache might solve an issue with incorrect DNS configuration, which can be the reason for the 504 gateway timeout error. Keep in mind that the method depends on the operating system you use.
The following steps are for Microsoft Windows:
- Open command prompt command (CMD) by pressing Windows+R keys simultaneously, then type cmd on the dialog box and press Enter.
- On the CMD window, type ipconfig /flushdns and hit Enter.
- There will be a confirmation message if you successfully clear or reset the DNS cache.
Reset the .htaccess File
Adding and removing plugins from WordPress will generate entries to the .htaccess file. However, it will slow down the server response time if the plugins are incompatible, which can lead to 504 gateway timeout error.
The easiest solution is to reset the .htaccess file to its original state. Here is how to do it:
- Access the file manager from your web host.
- Find the public_html folder then navigate to the .htaccess file.
- Make a copy of the file with a different name, such as .htaccess.backup.
- Open the original .htaccess file on the text editor and replace the existing code with the following:
# 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
5. Click Save to complete the process.
6. Test if the method works by reloading your website again.
Syntax Error
Syntax error is mostly caused by incompatible plugins or themes. However, finding the plugins or themes that cause the error can be a bit technical.
First, enable WordPress debugging to locate the error. Use the cPanel File Manager or File Transfer Protocol (FTP) client, such as Filezilla, one of the most used FTP clients.
Here are the steps to follow:
- Open the file manager and navigate to the public_html -> wp_config.php.
- Right-click the wp_config.php file and select edit. It will take you to the text editor.
- Add the following snippet before /* That’s all, stop editing! Happy publishing. */:
|
Here is how it looks on the wp_config.php file.
4. Save the change.
5. Reload the website to identify the full path of the syntax error.
Say, a corrupted theme causes the error. To fix the error, you need to access a file manager again and navigate to the public_html -> wp-content -> themes folder. Select the theme that causes the error and open the index.php on the text editor.
For example, Twenty_Twenty_One theme is corrupted. Let’s take a look at the following code.
It seems the error is caused by a missing semicolon at the end of the get_footer function. Therefore, simply type a semicolon on the 38th line.
get_footer (); |
Save the file and reload your website. Do not forget to disable the WordPress debugging once the problem is solved by removing the define( ‘WP_DEBUG’, true ); function.
Database Connection Error
There are several issues that can lead to a database connection error, such as a corrupted WordPress file, corrupted database, or incorrect login credentials. The easiest solution to fixing the error is to reinstall the WordPress core files.
However, if the problem persists, you can use the following method instead:
- Access your cPanel file manager or open your WordPress directory via an FTP client.
- Navigate to the wp-config.php file and open it using a text editor.
- Scroll down until you find a line that says /* That’s all, stop editing! Happy publishing. */
- Type the following snippet code above it and save the file.
define('WP_ALLOW_REPAIR', true); |
5. Once completed, you will get access to WordPress’ database repair feature. Visit yourwebsite.com/wp-admin/maint/repair.php. Note that you need to rename yourwebsite.com with your own domain name. Then, you will see the following page.
6. Select one of the options above. Wait until the process is complete
7. Access your website again to see whether the error is solved. Do not forget to delete the define(‘WP_ALLOW_REPAIR’, true); function from the wp-config.php file.
White Screen of Death
After using WordPress for quite some time, you might experience a white screen of death error. When this error occurs, your site will only display a blank page. A white screen of death error can be caused by several reasons, like memory limit consumption, theme and plugin conflict, and server issues.
Solving the white screen of death error is quite easy. Follow the steps below to get rid of the error:
- Access your cPanel file manager.
- Find wp-config.php file inside the public_html folder.
- Open the wp-config.php file by right-clicking on it and select Edit.
- On the text editor window, navigate to the line that states /* That’s all, stop editing! Happy publishing. */.
- Add the following snippet code above it:
define(‘WP_MEMORY_LIMIT’,’64m’) ; |
6. Click Save to finish editing the file.
7. Reload your site to check if the error is fixed.
500 Internal Server Error
Running into a 500 internal server error is a common situation to most WordPress users. The error is likely caused by a plugin incompatibility and a memory limit.
Plugin Incompatibility
If installing a new plugin causes a 500 internal server error, the best way to fix it is to disable or remove the plugins that bring the error.
To do this, simply access your WordPress dashboard and go to Plugins. From there, deactivate all the plugins and begin to activate the plugins one by one. Reload your website to check if the problem is solved. If the website runs normally, keep the plugin active until you find the incompatible plugin.
Memory Limit
Running out of memory might be the culprit behind the 500 internal server error. Memory limit can lead to this error because installed plugins or scripts use up an amount of memory to work.
Thus, we recommend increasing the PHP limit by editing the .htaccess file and adding the following functions:
php_value upload_max_filesize 128M php_value post_max_size 128M php_value max_execution_time 300 php_value max_input_time 300 php_value memory_limit 256M |
After that, check whether the problem is solved by reloading your site.
Conclusion
Troubleshooting WordPress errors can sometimes be technical and demanding. If any errors are left unattended for too long, the search engines might unindex your website from search results, which will negatively impact its credibility and traffic.
Therefore, getting familiar with fixing these top five WordPress problems are necessary. Here is a recap of the errors:
- 504 Gateway Timeout
- Syntax Error
- Database Connection Error
- White Screen of Death
- 500 Internal Server
Prevent these errors from appearing in the future by always maintaining your WordPress performance and security. Also, make sure to always update your WordPress to its latest version.
We’re a Digital Team from EngineTemplate with 5 content experts. Our team has 5 years exp in open source Joomla and WordPress, we make daily blogs and build useful resources for everyone who is having issues with open source while using it.