Search
Close this search box.

10 Most Common WordPress Errors and How to Fix Them

[updated_on]
Share this post:

There are many errors you may encounter in the course of creating and managing your website. Here are a few of the most common causes of headaches for website owners and how to fix them.

Before making any changes to your website, however, it is always best to create a complete backup to prevent an even bigger headache if anything is accidentally broken in the process of implementing a fix.

1 – Syntax error

This can happen when you unintentionally miss a line of code or if a code has incorrect syntax when adding code snippets into WordPress. The notice may say:

Parse error - syntax error, unexpected $end in /public_html/site1/wp-content/themes/my-theme/functions.php on line 278

You will have to locate where the lapse is, which can be a missing bracket, or additional character or symbol where there should be none, or vice-versa. One fix can be to review any snippets you copied and pasted, and compare with your source. You can also undo any changes you made, then repeat copy-pasting. It may be that you missed a character or two.

In case you are locked out of the Editor, you may need to use an FTP program to access your site’s files. Check the error message to see what file and line you have to edit, then correct or remove any code you added. Once you save the file then upload it back to your server, your site will again be working upon refresh.

2- Internal Server Error

The Internal Server Error, or Error 500, usually occurs if the server is unable to locate what is causing the problem. There are several ways to help you figure out what has gone wrong. Try the following one by one to help you diagnose the error.

  1. Check for a corrupt .htaccess file—this can be found in the same directory where folders such as wp-admin, and wp-content are located. Rename the file, then refresh your site to see if it works properly. If it does, then simply go to “Settings” then “Permalinks”, then click “Save” to let WordPress generate a fresh .htaccess file.
  2. You will know to increase the memory limit if you only get an internal server error when you attempt logging in to WordPress admin, or when you are uploading an image in wp-admin. To solve this problem, you can increase the memory limit. This is done using the following steps:
    1. Create a blank text file with file name “php.ini”
    2. Paste “memory=64MB” into the blank “php.ini” file
    3. Save and upload the file to /wp-admin/ using FTP
  3. Try disabling all your plugins and turning them on one-by-one to see if one in particular causes the error. Delete the one that is causing the problem, if you find it.
  4. Re-upload wp-admin and wp-includes folder using a fresh install of WordPress, in case any files were corrupted.
  5. If everything fails, you may have to ask your hosting provider for assistance.

3 – Error Establishing a Database Connection

This error usually occurs when any database credentials have been incorrectly entered leading to the website being, as the error says, unable to connect to the database. Here are a few steps to diagnose the error:

  1. See if you get the error on both the front-end and back-end. If you get different error messages, you should repair the database by adding the line “define(‘WP_ALLOW_REPAIR’, true);” to your wp-config.php file. After doing this, go to http://www.yoursite.com/wp-admin/maint/repair.php to repair and optimize the database. Once the database has been repaired and optimized, remove the line you added to the wp-config.php file.
  2. Check your wp-config.php file against these line of code:

 

define('DB_NAME', 'database-name');

define('DB_USER', 'database-username');

define('DB_PASSWORD', 'database-password');

define('DB_HOST', 'localhost');

Make sure the values are in accordance with the credentials of your website. You can also try replacing the localhost value with the IP address.

Test the responsiveness of your web host (MySQL Server), because sometimes this error may be caused by a server that cannot handle heavy traffic. The easiest way to do this is by getting in touch with your hosting provider.

4 – 404 Error

In order to fix this error you have to reconfigure or update permalink settings. Go to “Settings” then “Permalinks”, then click on “Save Changes”. If this does not fix the problem, it may be necessary to manually access the .htaccess file by logging in to the server using FTP. Allow modifications to the file by changing permissions to 666 instead of 660, then add the following code:

 

# BEGIN WordPress



RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]



# END WordPress

After adding and saving the file, revert permissions to 660.

5 – Sidebar below content

When this happens to a WordPress site, the cause may be an open div tag or extra closing div, or an incorrect CSS width, which breaks a theme. In order to fix this error, you have to review your theme to ensure there are no broken div codes. If there are no unclosed div codes, you can check if you are using a proper width ratio—the width of all your elements should be in accordance with the width of your container.

6- White text and missing buttons in visual editor

If this happens, you should check if there are any JavaScripts in the user’s admin area, missing or corrupt TinyMCE files, or plugin errors. Other solutions will be to clear the cache, replacing the “/wp-includes/js/tinymce/” folder with a new one, or adding “define(‘CONCATENATE_SCRIPTS’, false);” at the very top of the wp-config.php file below the opening tag.

7 – Memory exhausted

If you only see a white screen, or receive an error message saying the following, you will need to increase your default allocated memory limit.

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in

/home/username/public_html/site1/wp-includes/plugin.php on line xxx

Add this line to your wp-config.php file’s main php tag to increase memory to 64MB:

"define('WP_MEMORY_LIMIT', '64M');".

If this does not work, contact your hosting provider.

8 – Image upload issue

If the images in a website go missing, and a user cannot upload images to a post using the media uploader, this may be due to incorrect file and directory permissions. To fix this issue, the easiest thing to do would be to have your hosting provider fix the permissions for you. You can also fix this on your own by connecting to your site using FTP, then going to your /wp-content/ directory. Find the /uploads/ folder then right click on it, then select “file permissions”. Set file permissions for the uploads directory and all its subdirectories to 744—check “Recurse into subdirectories”, then click on “Apply to directories only”. Click OK to apply changes. If 744 does not work, try the value 755.

After this, set the file permissions for all files in the uploads directory. Right click on the uploads folder, then select file permissions. Change the numeric value to 644. Check “Recurse into subdirectories” then click “Apply to files only”. Click OK to apply changes.

9 – “Are You Sure You Want to Do This”

This error usually happens when a plugin or theme fails to properly use special security keys called Nonce. To fix this error, you will first have to deactivate all your plugins or themes, then activate them one-by-one to see which is causing the error. Delete the culprit.

If this does not work, you will have to take a more drastic approach. After first backing up all your files, you will have to delete all WordPress files from your server except the wp-content directory and its contents. Afterwards, upload a fresh copy of WordPress to your server then create a new wp-config.php file in the root directory.

Using your old wp-config.php file if needed, add all sections except “Authentication Unique Keys and Salts”. Get rid of all lines starting with “define”:

 

/**#@+

 * Authentication Unique Keys and Salts.

 *

 * Change these to different unique phrases!

 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}

 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.

 *

 * @since 2.6.0

 */

define('AUTH_KEY',         '`+7nTNbUD?|W)b3gMfG~g[zr8N6}m%MZ|L');

define('NONCE_KEY',        ']Zj5i*hHlsUWKg2|>YF,X+xpd-_`I[nFmA6ZLw~;EW7g0.s5EaZCAJ=j]./5z^X~');

define('AUTH_SALT',        'e*l:hUsddFIxm1E7y-n#_}3,4)J]S sM6-MI3aB#Qk1Xx`pwt6?**i}');

Save your new wp-config.php file, then upload it. Refresh your site and see if the error again occurs.

10 – Accidental maintenance mode

When the message “Briefly Unavailable for Scheduled Maintenance” appears accidentally, this means that there may have been an unfinished WordPress update. Ensure that you have manually or properly updated your site, then delete the “.maintenance” file from your root folder using FTP. Ensure that you have enabled your FTP application to show hidden files.

It is never an easy task to resolve errors. Hopefully this list helped you diagnose your website’s problem. If all else fails, do as doctors or patients do for medical cases—do ask us for detailed instructions or your peers for help.

Share this post:

Leave a Comment

Your email address will not be published. Required fields are marked *

WPLearningLab