WPNeon

Discover New WordPress Themes & Plugins

Tutorials

10 Most Common WordPress Errors and How to Fix Them

WordPress has been around in the Content Management space for more than 15 years now. It is the most popular content management system available. WordPress is based on top of PHP and MySQL. It gives users different features enabling them to create interactive and responsive sites in a short period. WordPress supports different plugins which have made web development faster and easier.

If you have been using WordPress for quite some time now, you may have noticed a few errors and problems that are common with every WordPress sites. These errors are likely to occur in every WordPress. This tutorial will not only help learn about the common mistakes but also teach you to solve these errors. Next time, you encounter such errors you will be ready to solve them in no time.

Prerequisites

  • WordPress Site Admin Credentials
  • Text Editor (Sublime, Notepad, etc.)
  • FTP Client (FileZilla, Cyberduck, etc.)
  • cPanel Credentials

It is always advisable to fully back up your WordPress site so that you can continue from where you left if something went wrong in the process. Here are some of the top 10 most common errors and their solution in WordPress you are likely to encounter during the Web Development process.

Most Common WordPress Errors

#1. Error Establishing a Database Connection

Error Establishing a Database Connection

You are likely to encounter this above message, if your WordPress site is having problem connecting with your MySQL database. When you face this issue, your site won’t be able to fetch the data and information stored in your database. This issue occurs if the credentials inside the wp-config.php file gets mismatched. This is an config file which is stored in the root directory of your WordPress site. This issue can also occur due to your hosting provider or when your website has been compromised.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name');
/** MySQL database username */
define('DB_USER', 'username');
/** MySQL database password */
define('DB_PASSWORD', 'password');
/** MySQL hostname */
define('DB_HOST', 'mysql3001.mochahost.com');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');

Check if the database name, username and the password are correct. Setting the right credentials solves this issue in most cases. You can also contact your hosting support to resolve the issue.

#2. ERR_TOO_MANY_REDIRECTS

WordPress Redirect Loop Error

ERR_TOO_MANY_REDIRECTS is often seen in WordPress sites. This issue is likely to occur due to server misconfiguration or plugins redirect function or due to incorrect WordPress settings.

Clear your browser’s cookie and cache, and then clear the cache from the WordPress admin page and see if it fixes the issue. This can also sometimes fix the issue. If the issue persists, try clearing the CDN cache or disable it temporarily.

Common WordPress Errors with Solutions

Login to your WordPress Dashboard and go to settings and check the WordPress URL settings. Check if the URL’s are correct or not.

Common-WordPress-Errors

You can also check this from the wp-config.php file if you are not able to access the WordPress admin dashboard. This config file is located inside the /home/user/public_html/wp-config.php. Add the following lines of code the file.

define('WP_HOME','http://www.example.com');
define('WP_SITEURL','http://www.example.com');

Also, Inside the public_html look for the .htaccess file. Edit the file and search for the keyword Rewrite. Add the following changes to it.

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Save the changes and refresh your site. You should now be able to access your site without facing the issue.

#3. WordPress 502 Bad Gateway Error

WordPress 502 Bad Gateway

You will face this issue due to some different reasons. When you want to fetch information from a site, you send request to the server using your browser; if something doesn’t get processed along the way, you will encounter this issue. This bad gateway issue can be seen due to bugs in the database, server timeout, firewall, issues in the PHP code, faulty plugins or when your site has been attacked using DDoS. It is easy to fix this issue.

Sometimes, a simple hard refresh can fix this issue. Disable all the plugins of your WordPress site. You can just do this by logging into the WordPress root directory using any FTP software like FileZilla. Go to wp-content and then head over to the plugins folder. Rename the plugin folder name to plugin_old to disable all of your plugins. Load your site again. Now, change the folder name back to the original and head over to the WordPress dashboard. Now activate the plugins one after another and find out the faulty plugins.

You can also check if there is an issue with your current theme. Access your theme folder using the FTP application. Your theme folder is inside the wp-content folder inside the themes directory. Make a copy of your theme and delete the theme. Now, Reload the site. If you see a white screen, your theme is corrupted. It is likely that you need to replace the theme or contact your developer to fix this issue.

#4. Internal Server Error

Internal Server Error

This is a common issue in WordPress. It occurs when the server is unable to identify the issue. You need to check for the corrupted .htaccess file if you encounter this issue in the first place. Rename the .htaccess file to .htaccess_fault After renaming the file, change the Permalink settings in the WordPress dashboard to Save button without making any changes. This will generate a new .htaccess file. This file is located inside the public_html folder inside the root directory.

Common WordPress Errors

You can also encounter this issue when you have reached the PHP memory limit. You can also deactivate the plugins one by one if there is a faulty plugin causing the issue.

#5. White Screen of Death

White Screen of Death

You will face this issue when your website is out, and your browser has to show you, a screen with nothing inside it. You do not see any errors when you face this issue, and it is quite annoying. Here are some of the fixes for the White screen.

  • Increase the PHP memory limit: When you have reached the memory limit, you are likely to encounter this issue. Increasing the memory size in the wp-config file can solve this issue.
  • Disable the faulty plugin: Check for the faulty plugin and disable/remove it to solve the white screen problem.
  • Delete the faulty theme and use the default theme.
  • Contact your hosting provider if an issue persists on their side.

#6. “Upload: Failed to Write File to Disk” Error in WordPress

You will face this issue when you are uploading or writing files to your server. This issue occurs due to incorrect site permissions. Due to these permissions, you will not be able to upload files to the server. To fix this issue, you will need to change the File Permissions. Login to your server using an FTP application (FileZilla). Search for the wp-content folder inside the public_html in the root directory. Right-click the folder, and select File Permissions.

A dialog box “Change the attributes” will appear. Make the following changes.

  • Owner permissions: Read, Write, Execute
  • Group permissions: Read, Execute
  • Public permissions: Read, Execute
  • Numeric value: 755
  • Recurse into subdirectories: Yes
  • Apply to directories only: Yes
  • Click OK to save your settings

#7. WordPress Fatal Error: Allowed Memory Size Exhausted

WordPress has a memory limit of 64 MB by default. You are likely to face this issue when WordPress runs out of memory and cannot run the functions.

Fatal error: Allowed memory size of 33554432 bytes exhausted
(tried to allocate 2348617 bytes) in 
/test/123/public_html/wp-includes/plugin.php on line xxx

You can quickly change the PHP memory limit by editing the wp-config.php file which resides inside the public_html folder of the root directory of your site.

define(‘WP_MEMORY_LIMIT', '320M' );

Change the limit to the size of your choice and save the changes to the config file.

#8. WordPress Admin Locked Out

You will face this problem when you are locked out of the admin dashboard. You are locked out if you forget your password or your site has been hacked. You can recover your password using the recovery email. Sometimes, recovery emails can take a long time to reach your inbox. In this case, you can easily set the new password through PhpMyAdmin from the cPanel.

Login to your cPanel and Click on PhpMyAdmin and get inside the interface. When you are inside the database interface, search for the wp_users table and find your username in the user_login section. Right Click on your username and click Edit.

You will find user_pass field where you can set your new password. Set it to MD5 from the drop-down and click on Save Changes. You can now log in to your admin dashboard using the new password.

#9. “Briefly Unavailable for Scheduled Maintenance” Error after updating WordPress

Briefly Unavailable for Scheduled Maintenance

You will encounter this issue when you have just updated your WordPress site to a newer version. WordPress usually creates a .maintenance file to indicate that your WordPress site is under maintenance.

You can quickly fix this issue after you delete the .maintenance file from the root directory. Before removing the file, you need to make sure that your WordPress update has been successfully completed. If the update was not successfully completed, it might lead to other issues when you delete the .maintenance file.

#10. Site’s Sidebar Appearing Below the Main Content

You will encounter this issue when your WordPress sidebar has moved away from its default position to the main content of each page and post. It shows below the content. This occurs when there is an issue with the HTML/CSS of your theme.

Check if you have edited any of your themes recently and trying to change them back to their original state. If this issue persists, you need to check for the issues in the HTML/CSS code. The issue can also be diagnosed through the W3 Validator.

The issues are likely caused due to HTML elements with open <div> tags. If these tags are not properly closed, it can move the sidebar. Also, if the margin is not set properly in the style.css, the sidebar may move to new location.

Over to You

You are likely to encounter the above issues now and then in WordPress. If you have followed us till the end, you now have your solution to these issues.

10 Most Common WordPress Errors and How to Fix Them
5 (100%) 19 vote[s]

Leave a Reply