How to Fix a Broken WordPress Website
When your WordPress site breaks, you can’t help but feel helpless. You don’t know what causes the error, and it’s tough to find the source of the problem at the first try.
Luckily for you, in this article, we’ll show you some common cases of WordPress errors and how to fix them. Stay tuned!
Table of Contents
1. What to Do Before Fixing a Broken WordPress Site
Before you start trying to fix your WordPress site, there are a few simple tricks you can do beforehand, such as:
- Restore the backup of your site — at times, a broken WordPress site can be easily fixed by restoring the backup file. If you don’t know how to do it, check out this article for guidance.
- Disable new plugins and themes — new plugins and themes may contain faulty files that might trigger an error. If you have access to the admin area, deactivate all of your plugins and change your theme to the default one.
- Use the latest version of WordPress — updates come with bug fixes and new security patches, so using outdated software can lead to errors and security vulnerabilities.
- Reinstall WordPress core files — some files might be corrupted, so make sure to fix them by reinstalling WordPress. However, be careful not to overwrite your existing content or you’ll have to start over from scratch.
2. 6 Common Causes of a Broken WordPress Site and How to Fix Them
If none of the tricks above worked for you, then it’s time to dig a little deeper into the types of errors that you may be experiencing and how to fix them. That being said, remember to create a backup in case something happens during the troubleshooting. Let’s start!
1. 500 Internal Server Error
One of the most common WordPress issues is the 500 Internal Server Error. It happens when there’s some misconfiguration in the server, but the server can’t identify what it is.
Thus, Instead of loading your web page, the server displays error messages and asks you to contact the server administrator to provide information about your latest activities on the site.
How to Fix It?
For starters, try to enable WordPress debugging by editing the wp-config.php.
To do so, access your site’s File Manager, go to the public_html directory, and search for the file there. After that, insert define( “WP_DEBUG”, true ); just before the “That’s all, stop editing! Happy blogging.” line.
If this doesn’t work, check whether you have a corrupted .htaccess file. For this task, rename the file to anything else and then refresh your website. If the error disappears and the .htaccess file is indeed the problem, then you’ll need to create a new file with the default .htaccess code.
2. 502 Bad Gateway Error
Bad Gateway error is one of the most confusing errors in WordPress. The issue usually occurs when the server fails to execute users’ requests properly. However, users’ misconfigurations could also be the culprit.
How to Fix It?
The solution to this error will depend on its exact cause. It can be solved by refreshing the browser, or you’ll need to check the error log via File Manager or an FTP client. For more in-depth tutorials on how to fix the 502 bad gateway error, visit hostinger.com/tutorials/502-bad-gateway.
3. Syntax Error
If your WordPress shows Syntax Error after editing the site’s web files, there’s no need to worry. It simply means you’ve accidentally made a coding mistake.
While the error does seem fatal, it’s actually one of the easiest errors to fix in WordPress. Syntax Error messages always display the location of the corrupted file along with the line number that causes the issue.
How to Fix It?
Access the corrupted file via File Manager or an FTP client, and then locate the line defined in the error message. After that, identify the exact problem — it could be a misspelling, bad punctuation, missing matching parentheses, and so on.
4. Database Connection Error
Establishing Database Connection error happens when the browser can’t connect to the database where all of your site’s files are stored.
How to Fix It?
The most common reason for this error is incorrect database credentials. If you’ve changed the database’s username or password recently, then you need to update the credentials information stored in the wp-config.php file.
If that didn’t work, try adding define(‘WP_ALLOW_REPAIR’, true); to your wp-config.php file, right before the “That’s it, happy blogging.” line.
After that, go to yoursite.com/wp-admin/maint/repair.php. You will get an option to repair your database right from the WordPress admin area.
5. WordPress 404 Error
When stumbling upon a 404 error, it’s usually caused by some misconfigurations in your permalink settings. Luckily, this issue only requires a simple fix.
How to Fix It?
Go to your WordPress dashboard, head to Settings > Permalinks, and click Save Changes without changing anything. Next, refresh your website and see if it fixes the error.
If nothing happens, then restore the .htaccess to its default code to undo any changes made to the permalinks. Make sure to create a backup before you do this.
6. Fatal Error: Maximum Execution Time Exceeded
If this error pops out when you’re using WordPress, don’t worry! It simply means that the PHP script you run takes longer to execute than the limit allows.
PHP scripts that run longer than 30 seconds are assumed to be caught in an infinite loop, so the server must terminate it. Otherwise, those scripts will consume your server’s resources.
How to Fix It?
If you have access to your site’s root directory, you can easily increase your PHP limit by adding the following lines to the .htaccess file:
php_value memory_limit 256M
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 1000
Don’t forget to adjust the code according to your needs. However, if you’re not familiar with technical matters, we recommend asking your hosting providers for support instead.
3. Don’t give up – learn WP skills
There you have it! You’ve successfully learned the six common causes of a broken WordPress website and the methods to fix them.
Here’s a quick recap of the errors along with their causes:
- Internal server error — in most cases, this error happens due to a corrupted .htaccess file.
- 502 bad gateway error — occurs when your server sends out invalid responses because of server-related issues.
- Syntax error — triggered by coding mistakes in your web files.
- Database connection error — database connection problem, incorrect credentials, and corrupted database may be the culprits.
- WordPress 404 error — misconfigurations in your permalink’s settings.
- Fatal Error: Maximum Execution Time Exceeded — occurs when there’s a PHP script that has been running longer than the limit allows.
Having your site to stop working can be a pretty scary ordeal. However, now you know what to do the next time it happens again.
If you still have any questions regarding WordPress, please check our WordPress courses or get in touch with our WordPress experts!
- Blogger and Educator by Passion | Senior Online Media & PR Strategist at ClickDo Ltd. | Contributor to many Education, Business & Lifestyle Blogs in the United Kingdom & Germany | Summer Course Student at the London School of Journalism and Course Instructor at the SeekaHost University.
- Digital MarketingJanuary 8, 202412 Best Remote Tools For Remote Agencies In Marketing
- BrandingNovember 21, 2023Guest & PR Publication Case Study Analysis of Guest Posts, Expert Guides, Listicles and Press Releases at the Green Living Blog
- Local SEO ServicesNovember 20, 2023London Rubbish Removal’s Rise to the Top of Google with Seamless SEO Efforts by ClickDo
- Content MarketingNovember 15, 2023Guest & PR Publication Case Study Analysis – How effective are Guest Posts, Expert Guides, Interviews, Listicles and Press Releases at UKEB?