What, Why, and How: Common WordPress Errors and their Solutions

Published Mar 31, 2017
What, Why, and How: Common WordPress Errors and their Solutions

Absolutely nothing is foolproof, not even WordPress.

Despite the great flexibility and load of features that put the rest of the CMS crowd almost out of the competition, WordPress websites are just as prone to glitches and errors as anything.

But what makes WordPress special is the sheer amount of free help you can count on from the community. The Codex combined with support forums and millions of resources covering almost every possible aspect of WordPress will make sure that you’re not left on your own.

As part of my ongoing contribution to the growing list of WordPress resources, I have compiled a list of common WordPress errors, their causes, effects, and solutions for newbie web developers. So when faced with any of the following errors, which may seem like the end of the world, you can resolve it on your own in a matter of minutes.

1.Cannot modify header information

The Error:

When you visit your website URL, you get a message that starts with:

“Cannot modify header information – headers already sent by …”.

Why it happens:

The error essentially means that something else was sent before and after the actual header’s code could be processed. In this case, it’s most likely some errant characters or spaces, or maybe even a code snippet placed before or after the closing and opening tags in a WordPress script.

Solution:

Start by taking a closer look at the error message. It should look something like this:

Warning: Cannot modify header information - headers already sent by (output started at /path/blog/wp-config.php:76) in /path/blog/wp-login.php on line 43

The path within the brackets and the number at the end is the exact place of error. In this example, it’s line 76 of wp-config.php.

Go to your WordPress installation directory and find the file that says ‘already sent the header information.’ Open it in a text editor like Notepad++.

Check line 76 and make sure there are characters, spaces, or code lines before <?php and after >? tags. Save this file on your desktop: keep the name, but change the ‘Encoding’ (you’ll see a box before the ‘Save’ button) to UTF-8.

Upload the file back to where you found it in WordPress directory via FTP.

Tip: Avoid this error in future by using JavaScript instead of the wp_redirect() function for redirection purposes.

2.White Screen of Death

The Error:

This one is so common that geeks abbreviated it ages ago (WSOD). And yet, it can still cause severe heart palpitations for anyone who’s confronted with the terrible, blank White Screen of Death

Basically, any time you try to visit any page of your WordPress website (even backend or admin), you’ll see a big fat blob of this:
Picture1.png

Why it happens:

Most commonly, it happens because of WordPress plugin or theme compatibility issues.

Solution:

If you can still see the backend, login to your admin dashboard and deactivate all the plugins. Just every last one of them. After that, visit the site URL again.

Now activate your plugins one by one. After every plugin you activate, refresh your browser window to see your website. The moment it breaks, you have found the culprit plugin. Contact the plugin and theme authors to discuss and resolve this issue.

If your backend is also compromised, deactivate the plugins via their files. Go to your WordPress installation directory in FTP and go to path: wp-content/plugins. Rename the plugins directory to anything else to deactivate all the plugins. This will vanquish the WSOD — you can then move all plugins’ files to computer. Restore your wp-content/plugins directory name, and upload the plugins manually, one-by–one. Keep checking the front-end (browser window that displays your website) to keep track.

It’s tedious work. You just have to bear with it.

3.All posts display “404 Not Found” Error

The Error:

Anytime you visit your posts, you get this:

404 Not Found

The web server cannot find the file or script you asked for…which is baffling because you HAVE posts on your website and the stupid server should be able to find them.

Why it happens:

Common causes include anything from broken links to corrupted or deleted .htaccess file.

Solution:

Let's start with a simple and obvious-in-hindsight solution first.

Go to your WordPress admin >> Settings >> Permalinks. Choose another setting, hit save, and get back to your erstwhile setting. Now try visiting your posts again.

The above method fixes .htaccess.

If you still can’t see your posts, you’ll have to fix .htaccess manually. For that, open your FTP client and access the WordPress directory. Look for the file in the same directory as /wp-includes.

Now add this bit in your .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Sometimes, it’s just a faulty URL. Before coming to the conclusion that something’s wrong, check other posts in various browsers.

4.HTTP500 Internal Server Error

The Error:

You'll see a message that looks something like this:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request…

Why it happens:

This particular error (and its fix) applies to all websites on the Internet. It can happen because of corrupted .htaccess or WordPress core files, compatibility issue (plugins or theme), exceeded memory limit, and more.

Solution:

1. .htaccess: Since a corrupted ‘set of directions’ in .htaccess is the most common cause, you can make a safe bet on this. Simply, find the file (as directed in 3 >> Solution) and cut it from the directory. Once you've done that already, revisit your website to see if the problem has been fixed. If the problem is fixed, go to your Admin >> Settings >> Permalinks and reconfigure the settings to automatically generate a new .htaccess file.

2. Plugin/Theme Compatibility: Another common cause for this error. Make sure to deactivate all plugins and reactivate them one by one (as directed in #2 >> Solution). If none of the plugins caused this, then try switching to a default theme.

3. Allowed memory size exhausted: Can be another reason for internal server error. Increase PHP memory allocation.

4. WordPress core: Corrupted core files can be replaced by simply downloading WordPress again. Go to WordPress.org, download the latest version, and install it.

5.Execution Time

The Error:

This:

“Fatal Error: Maximum execution time of 30 seconds exceeded in /file-path.php on line 538.”

Why it happens:

Your server or script in question is taking too long to respond/process. Usually, the default execution time is 30 seconds, but it may vary depending on hosting provider.

Solution:

First, make sure you have a backup of your website content and database.

Now, there are three ways to fix this:

1. htaccess: Add the following code to this file to increase execution time to 60 seconds.

php_value max_execution_time 60

2. php.ini: You may need to ask your hosting provider for access to this file. Add the following:

max_execution_time = 60

3. Plugin: WP Maximum Execution Time Exceeded will let you set execution time to 60 seconds only.

Final Remarks

That wasn’t so hard, was it?

If you're not a developer, the only real hurdle is the mental block you might have against anything ‘code-like’ or ‘server-based’ in nature. Once you get past that, you can solve most of these WordPress errors on your own. If you're just getting started, read Beginner’s Guide: Setting Up Your First WordPress Website.

Discover and read more posts from Emily Benson
get started