Troubleshooting WordPress: Common Fatal Error Messages and How to Fix Them

There are some WordPress problems that crop up again and again. And there are few people better equipped to deal with them than the many Support Pros across the WordPress Universe. I’ve teamed up with WPMU DEV’s awesome Mason James, big-boss of our own Support crew, to look at some common WordPress problems. Over the next few weeks we’ll look at how you can address them.

Today we’re going to look at some of the common error messages that appear repeatedly on the WPMU DEV forums.

Sometimes you’ll get an error message, other times you’ll only get a white screen and a lot of confusion.

If your screen is completely white you’ll need to find your error log to figure out what the problem is.

Find Your Error Log

Your error log contains all of the information that you need for troubleshooting your WordPress problems. To find this you’ll need to open your FTP program and navigate to your WordPress folder. In either the root folder or in wp-includes you’ll find a file called “error_log”

These may look like gobbledygook but it’s actually useful information that can help you to fix your problems.

1) Error Message – there are a number of different error messages which you may have become familiar with. The most common of these are:

Cannot modify header information – header already sent

Call to undefined function

Allowed memory size exhausted

2) Plugin or theme file that you have a problem with

3) The line in the file that has the problem – this isn’t always exact but look around that line and you should find the problem

Now you’ve got your error log, let’s take a look at some of the common Fatal Error messages.

Cannot modify header information – header already sent

This indicates that there are some characters outside of your tags. PHP does not like this. These can be as difficult to spot as something as innocuous as an extra space can cause the problem. Here’s my error:

Warning: Cannot modify header information - headers already sent by (output started at /home/tinkerwe/public_html/wp-content/plugins/facebook-send-like-button/fgb.php:1) in /home/tinkerwe/public_html/wp-includes/pluggable.php on line 897

Let’s break this down:

a) Warning: Cannot modify header information – headers already sent

I’ve got some characters somewhere that are causing problems.

b) There is a problem on line 1 of the Facebook send like button

Let’s check out line 1 of the Facebook-send-like-button:

Argh! There’s a load of spaces –who put them there?!?! (Apologies to the plugin developer as it wasn’t them ;) .

Let’s delete them:

Save the file.

Let’s see if the site is fixed:

W00t!

Call to undefined function

This error means that a plugin or a theme expects something to be there which isn’t – hence the undefined function. It could happen for a number of reasons:

An error during auto-upgrade. If this happens you should upgrade manually

An error during auto-install. Like above reinstall manually

A plugin or theme that is incompatible with your version of WordPress. This could happen with an older version of WordPress with a new plugin. Or perhaps you’re trying to install a plugin that is only compatible with Multisite on a single site installation. If it happens following the installation of a plugin use your FTP to disable the plugin.

Check out this error:

Fatal error: Call to undefined function is_post_type_archive() in myrootdomain/_sites/dcambrose/wp-content/plugins/qa/core/functions.php on line 24

This error is telling me that the QA plugin is making a call to a function is_post_types_archive but that it isn’t there.

Solution?

Access the plugin via FTP and either delete it or rename the folder

Go back to your site, refresh, and it has returned!

The problem here is that the Q&A plugin isn’t compatible with any version of WordPress prior to 3.1. In order to ensure this doesn’t happen you need to check whether a plugin or theme is compatible with your version of WordPress.

Fatal Error: Allowed Memory size exhausted

This error occurs when the amount of memory allocated to WordPress isn’t enough to perform the task that you want.

To fix this error you need to increase the amount of memory that WordPress can use.

To do this you can either edit wp-config.php or your php.ini file.

To edit wp-config.php add the following line:

define('WP_MEMORY_LIMIT', '128M');

or whatever amount you want.

Editing your php.ini file is a bit more complicated as it’s not a file that comes with WordPress but is part of your hosting account. You should check out this tutorial on increasing your memory limit using php.ini.

140+ Plugins & Themes

35 Responses

There are 2 other fairly common causes of the second error message; and 1 other fairly common error message that should probably be mentioned.

When you see the “Call to undefined function” error message, that could also mean that someone (especially a plugin or theme developer) simply made a typo when trying to call a function. Maybe they were trying to use the get_post_meta() function, but they mis-typed it as get_post_meat() instead. If it’s a part of the plugin or theme that’s only used under certain circumstances, the author may have overlooked the typo.

It’s also highly possible (especially with themes) that the developer wrote something that’s dependent upon another plugin, but failed to do any proper checks for that plugin before trying to use its functions. I have seen a lot of themes that are dependent on plugins like wp-page-navi, but they just seem to assume that the website owner will have that plugin activated before using the theme, rather than actually checking to see if its functions exist before using them.

Finally, one other error message that’s fairly common is the “function already defined” error. The most common cause of this error is probably when people incorrectly try to create child themes; but copy the entire functions.php file from the parent theme. It can also happen when plugins fail to use original function names and they begin to clash with each other. Finally, this can also happen (as with the “undefined function” error) when an automatic upgrade doesn’t complete properly.

Nice debugging tips here, Siobhan, but I can’t find error_log file anywhere in any of my WordPress installations. Does it need to be somehow enabled in wp-config, pre-create the file with appropiate permissions or something else?

Ok so I run a WP blog with a back-end for products, sales, and what not. The problem is: more and more often the WP blog is unreachable while the HTML back-end is still reachable.

Sometimes the blog returns a blank page when loading, sometimes it does load, sometimes it says my internet connection is down (which isn’t the case). These problems only occur on occasion because the site’s online most of the time.

Traffic to the blog has increased a lot during the last couple months, but the problems already existed before. So I don’t think it’s the traffic, but what can it be?

I get the feeling I’m getting way more traffic than Analytics says simply because of this load problem. Can you recommend any solutions and do you think I should keep a record of site uptime so I know how much it’s offline?

There is no error log and I don’t know how to make one. I am seeing that traffic in GA is dropping, I think because of the problems (they were really severe yesterday). And for the looks of it, they’re just as bad today.

Click my name to check out the site.

I did notice that my cache plugin tends to slow down the Googlebot (in webmastertools the load time has increased since activating it), and that whenever I would reset the cache when installing a new plugin the load time would decrease.

I’m so hoping you can help me – I get this error message –
Fatal error: Class ‘NS_Widget_MailChimp’ not found in /home2/anba1182/public_html/wp-includes/widgets.php on line 324
and I seem to have lost my entire site (good God!)
Can you tell me what I could do next?
Thank you so much!!!

Hi I like the tutorials on how to fix error problems.
I have a big problem with my website. There is a fatal error message that I cannot solve:Fatal error: Call to undefined function list_category_posts() in /home/improdu9/public_html/wp-content/themes/multi-traffic-warrior-theme/sidebar.php on line 20

I inserted code (to functions.php in childtheme) to add a header. The result was the PHP parse error. Not knowing what to do to fix it as I couldn't get back to WP admin – screen was stuck on the Parse error, I went into the main folders and deleted the functions.php and replaced with a copy of the parent theme (thematic) functions.php. The fatal error is the result. I can get into the error log and am learning I can look into the php files there. Is there a way to repair the damage done?

@Melissa The first error looks like you didn’t close your tags somewhere.

Your fatal error is because you are trying to declare functions in both your parent and your child theme. You cannot declare functions twice. Delete the thematic functions from your child theme’s functions.php to solve the problem.

If the Minimalist Child theme has its own functions you should find them and paste them into your child theme’s functions.php file.

I am new to WordPress. I wanted to add a ‘read more’ link to my home page. I edited the Twenty Twelve: Theme Functions (functions.php) and saved it the first time and it stated File edited succesfully. However when I edited it again, this fatal error message came up.

You’ve just missed the most popular and the most irritating bug in WP Multisite, WordPress forums are filled with this bug. The Fatal error Call to undefined function wp_get_current_user(). and “No Sir”, even when everything is hooked properly after the “init” action, you still get this bug and you have absolutely no clue why the hell this appears in the core WP Files. Pardon my language but I have just wasted around 1 week juggling with this issue.

Your advice it fixed the “Fatal error: Allowed memory size of … exhausted”. Never had this problem with older versions of WP. Never had this problem on Godaddy hosting. I guess Network Solution hosting with WP 4.0 and my theme don’t play well together. Thank you. Thank You. Thank You. Never ever would have figured this one out.