Common WordPress errors, such as the critical WordPress error or the error establishing a database connection, serve an important purpose in the WordPress ecosystem — alerting you that something on your website went wrong.
Website downtime is frustrating, but WordPress shows errors for good reasons. The good news, however, is that most common WordPress errors are caused by the same issues and misconfigurations and therefore are relatively easy to troubleshoot.
In this comprehensive guide to fast and efficient WordPress troubleshooting, we will reveal the key components to fixing common WordPress errors and keeping your website running smoothly without the frustration of downtime and lost revenue.
Why Do Common WordPress Errors Occur and How to Prevent Them? 5 Main Aspects to Look At
Most of the time, WordPress errors are caused by misconfigurations in one of the following key components of your website’s environment:
It’s also possible for security issues leading to a hacked site or malware infection to generate errors or bring down a WordPress site.
Critical WordPress Configuration
WordPress relies on the critical configuration supplied by the website owner. This information is stored in the main WordPress configuration file, wp-config.php, and the wp_options table of the WordPress database. It must always be present there and correct. It includes the database connection details — database user, password, database host, the site address, and the location of WordPress, along with other information such as the WordPress salts and security keys.
The PHP version in use must be fully compatible with your website’s version of WordPress core and have the required PHP extensions installed. On top of that, the key PHP limits, such as the PHP memory limit, maximum execution time, and maximum upload file size, must be set high enough for your website to function correctly, especially if you have a resource-intensive theme or plugins.
Web Server Configuration
The HTTP web server configuration is used to set up permanent website redirects and install SSL/TLS certificates to keep web traffic encrypted. The Apache and Litespeed HTTP servers use an .htaccess file in the WordPress installation folder as the local configuration file that tells the web server how to handle requests coming to your website. It includes your site’s permalink structure and your redirection path. Other common HTTP servers have their own similar configuration files, like nginx.conf for NGINX.
WordPress plugins play a huge role in the WordPress ecosystem by extending the native capabilities of the platform. However, a new plugin increases the complexity of your website and usually adds to the load placed on your server’s database, memory, and CPU resources. Incompatible plugins or theme conflicts with a plugin will generate errors and possibly downtime for your site.
Keeping your website secure from attackers is always the highest priority. Any flaws in your WordPress website security open up the possibility of a hacker disrupting key WordPress functionality, which may lead to critical errors and downtime.
If a server or web application like WordPress is compromised and the hacker has altered the critical files, database information, or file permissions, this may lead to a fatal WordPress error.
Ensure you use the best security solutions to protect your WordPress website from ever-evolving security threats. iThemes Security Pro provides 30 ways of protecting the critical areas of your WordPress website, with advanced vulnerability scanning, file integrity monitoring, and passwordless authentication.
Before you Start Troubleshooting
Below, we have provided quick troubleshooting guides for the seven most common WordPress errors. Please note that the instructions below do not cover all situations and can not replace the help of a system administrator. If the steps outlined in this guide do not help you address an error you’re experiencing, we strongly recommend contacting your hosting provider.
Before attempting any of the fixes below, make sure you save a full backup of your website or have a recent working copy of it on the server or at a remote location. If you have a fresh backup of your website saved before the error occurred, restoring from it might be the best solution.
Backups are essential for all WordPress websites and can help you fix common WordPress errors in a matter of minutes, saving you time and effort. BackupBuddy, the industry-leading backup plugin for WordPress, will help you build a strong backup strategy, ensuring you always have a working copy of your website safely stored at a remote location.
How to Fix “Error Establishing a Database Connection” in WordPress
What does “Error Establishing a database connection” mean? WordPress failed to connect to its database with the credentials from wp-config.php. Your WordPress website is completely down.
Common issues behind the WordPress database connection error:
How to fix “Error Establishing a database connection”:
Step 1. Change your database user’s password and ensure the user is given all privileges for working with the WordPress database. Update the database connection information in wp-config.php, and see if it fixes the issue.
Step 2. Check and repair the WordPress database by using the wp db check and wp db repair WP CLI commands. Alternatively, add the define (WP_ALLOW_REPAIR, true) statement to wp-config.php and open your-wordpress-site.com/wp-admin/maint/repair.php in the browser and choose Repair Database or Repair and Optimize Database.
Step 3. See the iThemes full guide to fixing “Error Establishing a database connection.”
How to Fix “There Has Been a Critical Error on Your Website” Message in WordPress
What does “There Has Been a Critical Error on Your Website” mean? WordPress encountered fatal errors during PHP code execution.
Common issues behind seeing the critical WordPress error:
How to fix “There Has Been a Critical Error on Your Website”:
Step 1. Enable debugging in WordPress to see a more detailed error message. You can do it by adding define (WP_DEBUG, true) to the wp-config.php file. Check the new error message displayed in the browser; it will most likely point to a plugin error, missing or damaged WordPress core files, or PHP limits reached. It’s best to know the root cause of the issue before attempting the steps below.
Step 2. Restore the integrity of your WordPress installation using the wp core download WP CLI command with the –skip-content and –force flags.
Step 3. Deactivate the malfunctioning plugin or switch to one of the default themes using the wp plugin deactivate or wp theme activate commands. For example, wp theme activate twentytwentytwo will force WordPress to use the default Twenty Twenty-Two block theme. If this action brings your site back up, it confirms which theme or plugin is causing the error so you can focus on troubleshooting it.
Step 4. Update the PHP version in use and raise the PHP memory limit, maximum execution time, or maximum upload filesize if they have been reached. This article explains several ways to do this.
How to Fix “The Response Is Not a Valid JSON Response” Message in WordPress
What does “The Response Is Not a Valid JSON Response” mean? One of the most common WordPress errors, “The Response Is Not a Valid JSON Response ” indicates that WordPress encountered issues trying to communicate with the server from the WordPress dashboard. You can see this error while working in the Block editor or uploading media.
Common issues behind seeing “The Response Is Not a Valid JSON Response” in WordPress:
How to fix “The Response Is Not a Valid JSON Response”:
Step 1 (optional). Temporarily switch to the Classic WordPress editor if content publishing can not wait.
Step 2. Check your WordPress Address and Site Address from the Settings > General page of your WordPress dashboard or the corresponding WP_HOME and WP_SITEURL constants from the wp_options table of the WordPress database. Ensure the website address and the protocol are specified correctly, and if HTTPS is used, you have a valid SSL/TLS certificate installed. You can use an SSL checker for that.
Step 3. Regenerate your .htaccess file manually or resave the permalink structure from the Settings > Permalinks page of the WordPress dashboard.
Step 4. Deactivate all plugins to see if a plugin conflict might be at fault. You can do it from the WordPress dashboard or by using the wp plugin deactivate –all WP CLI command.
Step 5. Temporarily pause the content delivery network and ask your web hosting provider for assistance in checking whether the WordPress requests are blocked by a web application firewall.
How to Fix The Error: “Your PHP Installation Appears to Be Missing the MySQL Extension Which is Required by WordPress”
What does “Your PHP Installation Appears to Be Missing the MySQL Extension Which is Required by WordPress” mean? WordPress PHP failed to establish a connection to the WordPress database as the database driver is missing or misconfigured.
Common issues behind seeing the missing MySQL extension WordPress error:
How to fix “Your PHP Installation Appears to Be Missing the MySQL Extension Which is Required by WordPress”:
Step 1. Create a PHP information page phpinfo.php in the WordPress installation directory and insert <?php phpinfo(); ?> into it. Load the PHP info page and review if mysqli and mysqlnd sections are present.
Step 2. Install the missing mysqlnd database driver or reinstall it in case it is not loaded correctly. It will automatically enable support for mysqli. You can do it from your hosting control panel or by running yum install php81-php-mysqlnd on CentOS servers without a control panel, where php81 is the PHP version in use.
Step 3. Update your WordPress installation to the latest version.
Step 4. See the iThemes full guide to fixing “Your PHP Installation Appears to Be Missing the MySQL Extension Which is Required by WordPress.”
How to Fix the “Too Many Redirects” Error in WordPress
What does “Too Many Redirects” mean? “Too many redirects” is one of the common WordPress errors indicating that there are two or more competing redirects configured that create a redirect loop when the browser makes an attempt to load your WordPress website.
Common issues behind seeing the “Too many redirects” error:
How to fix “Too Many Redirects”:
Step 1 (optional). You can check your WordPress website’s redirection path to identify the conflicting redirects. To do this, run a simple BASH script from the command line.
Step 2. Check whether your WordPress website has a valid SSL/TLS certificate installed by using an SSL checker.
Step 3. Check your WordPress Address and Site Address from the Settings > General page of your WordPress dashboard or the corresponding WP_HOME and WP_SITEURL constants from the wp_options table of the WordPress database. Make sure the website address and the protocol are specified correctly.
Step 4. If you have a content delivery network such as Cloudflare enabled, check what encryption mode is chosen. End-to-end encryption requires both an edge SSL/TLS certificate configured on the CDN’s side and another SSL/TLS certificate installed on the origin server.
How to Fix The WordPress Login Redirect Loop
What the WordPress login redirect loop means. WordPress fails to authenticate you and grant access to the WordPress dashboard. An issue encountered during the authentication process makes WordPress go back to the login page.
Common issues behind seeing the WordPress login redirect loop:
How to fix the WordPress login redirect loop:
Step 1. Check your WordPress Address and Site Address from the Settings > General page of your WordPress dashboard or the corresponding WP_HOME and WP_SITEURL constants from the wp_options table of the WordPress database. Make sure the website address and the protocol are specified correctly.
Step 2. Check your wp-config.php file to ensure all critical information, including security keys and salts, is added correctly and there are no malicious injections. Use the official WordPress salts generator to update your security keys in wp-config.php. iThemes Security Pro allows you to update your WordPress security keys and salts without having to modify your WordPress configuration file manually.
Step 3. Ensure your website account is not over the disk quota and your server is not running out of disk space.
Step 4. Verify the integrity of your WordPress installation and make sure all file permissions are configured correctly. Ensure your database user has sufficient permissions to write to the WordPress database.
Step 5. Temporarily deactivate all plugins to see if a plugin conflict might be at fault. You can do it by using the wp plugin deactivate –all WP CLI command.
Step 6. See the iThemes full guide to fixing the WordPress login redirect loop.
How to Fix “This Account Has Been Suspended” Message on Your Website
What does the “This Account has been suspended” message mean? Your hosting provider has put a rule in place to redirect all web traffic coming to your WordPress website to the suspension page. This is done to restrict access to your website for various reasons.
Common issues behind seeing the “This Account Has Been Suspended” message in WordPress:
How to fix “This Account has been suspended”:
Step 1. Check the recent emails sent to you by your hosting provider to see why your WordPress website was suspended.
Step 2. Remove any malicious or illegal content reported by the hosting provider and secure your WordPress website.
Step 3. Avoid non-payment and upgrade your hosting plan if your website requires more server resources.
Step 4. Report the actions taken to your web hosting provider and request for access to your WordPress website to be restored.
WordPress is a powerful platform for building dynamic database-driven websites. Although it has proven to be extremely reliable and user-friendly, any misconfigurations in your server environment will result in seeing an error message on your WordPress website.
Keeping your WordPress website secure and performing regular maintenance are key to preventing common WordPress errors from being shown on your website, and iThemes Security Pro and BackupBuddy can offer tremendous help. If errors do occur, this guide will help you restore the functionality of your WordPress website and minimize downtime.
The Best WordPress Security Plugin to Secure & Protect WordPress
WordPress currently powers over 40% of all websites, so it has become an easy target for hackers with malicious intent. The iThemes Security Pro plugin takes the guesswork out of WordPress security to make it easy to secure & protect your WordPress website. It’s like having a full-time security expert on staff who constantly monitors and protects your WordPress site for you.
Kiki has a bachelor’s degree in information systems management and more than two years of experience in Linux and WordPress. She currently works as a security specialist for Liquid Web and Nexcess. Before that, Kiki was part of the Liquid Web Managed Hosting support team where she helped hundreds of WordPress website owners and learned what technical issues they often encounter. Her passion for writing allows her to share her knowledge and experience to help people. Apart from tech, Kiki enjoys learning about space and listening to true crime podcasts.
This content was originally published here.