You spent sleepless nights building your personal blog and one day you wake up and see that all your work is gone. And what if it’s a business website and you’re losing money for every minute of downtime. What’s next?
Common WordPress Errors
You rush to hire a developer, storm your hosting provider with messages to get your backup. It may take a lot of time, not even speaking of money. But in reality, the majority of the most common WordPress errors can be fixed within several minutes within several clicks. So, what are these errors and how to fix them? Let’s have a look.
1. Error Establishing a Database Connection
This error can be frequently found after you’ve just migrated to a new hosting provider or do the regular password changes. The error is caused by the mismatch between the entered database details in your configuration file and the same details in the Database Manager. These details are database password, user, and host.
In order to fix this, it’s necessary to go to the document root of your WordPress website in a hosting panel and locate the file wp-config.php. Then, verify that the details entered are the same as in your database manager (if your hosting is using cPanel, you need to check the details in MySQL Databases Menu). It can be done by copy-pasting the details from the Database Manager to configuration files.
Since the password is hidden, you may generate a new one and copy it to the wp-config.php file. Make sure that the database details in the configuration files are entered within inverted commas.
Note: if your database is located in the same hosting account as your WordPress files, the MySQL hostname should be ‘localhost’
If the things above do not help, in some really rare cases, the matter can be related to the database issues on the server. In this case, it can be fixed only on the side of your hosting provider. It’s easy to check where the issue lies by visiting your other websites with the same hosting provider or trying to set up a fresh WordPress installation to see whether the issue replicates there.
2. Syntax Errors
These ones are tricky as they tell that something is wrong with the code. When you work on the customization of your website, it’s essential to learn CSS and know the basics of HTML to play with the look of your website. And for sure, take into account that WordPress is written in PHP, and you need to get acquainted with that too in order to build some additional functionality.
Some of the syntax errors are critical preventing the website from loading, like this one:
While others may just break the layout of your website by images not being displayed, or buttons not working. These errors can be tracked in the browser console. Still, we recommend that you make the changes and test everything on the sandbox or local environment. Make sure to have a backup if debugging is not successful to revert everything to the previous stage.
3. Page Not Found (404) Error On Sub-Pages
This error is most commonly met on subpages. When you open your main page, you can see the content, however, all other pages return 404. In this case, the matter is most probably related to the permalinks configuration. To fix this issue, log in to your WordPress admin panel and navigate to the “Settings > Permalinks” section.
Once you find these options, you may either change the current permalinks structure or just resave it. It will modify your configuration settings and fix the error.
4. Internal Server Error (500)
In the majority of cases, incorrect files and folders permissions cause this error. They should be 644 for files and 755 for folders for the website to be correctly accessible on the Internet. Sometimes, if your hosting is on the Apache server (you can figure this out in the very error), the default configuration file .htaccess can trigger 500 Internal server error. To find out if that’s the case, make sure to locate it and disable the file by renaming it. If that fixes the error, then you will need to come back and figure out where the issue lies by disabling the rules one by one. If you haven’t used any custom rules, you may just leave the old one disabled, and create a new one with the default WordPress rule that looks as follows:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Any other rules necessary for the correct plugin functioning will be added automatically by the system.
5. White Screen
It’s the most mysterious error as it does not tell you anything. You just see the white screen and nothing more. To find out more, it’s necessary to check the error_log file that is located in the website file directory. Also, you may want to enable error reporting for troubleshooting. For WordPress, it is done in the configuration file wp-config.php. Open the file, locate the string define( ‘WP_DEBUG’, false ); and change ‘false’ to ‘true’.
Once done, refresh the page to see the errors. In addition, the error may be caused by PHP limitations.
In this case, you need to increase the PHP memory limit. It can be done via your PHP settings in the control panel (for cPanel it’s the menu PHP selector> Switch to PHP options).
By the way, reporting errors can also be enabled in this section. Just set the display-errors option to On.
Note: in some really rare cases, it may be related to the fact that your theme is configured incorrectly or even missing. So, make sure to check that your theme is present in the wp-content > themes section within the document root of your website.
While there exist many more custom errors in WordPress, the ones listed above are the most widespread. Now you know how to fix them. And some final tips that can prevent the majority of the issues are related to the security of your WordPress installation. Make sure to update the CMS version, plugins and theme once they are released, use strong passwords and install the security plugin. And it goes without saying that regular backups are essential regardless of your confidence in coding skills.
Enjoy developing your website with WordPress!
Leave a Reply
Your email is safe with us.