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”

error log in FTP folder

If you’d prefer to use Plesk to find your error log you can follow Sarah’s tutorial.

Open up the folder and you’ll see a whole load of messages:

WordPress error logThese 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:

extra spaces in plugin file

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:

white space removed in plugin file

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

qa plugin renamed to qa broken

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.

Here’s mine:

Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 6144 bytes) in C:xampphtdocswordpresswp-includeswp-db.php on line 1508

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.

Comments (35)

  1. Very nice.

    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.

  2. 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?

  3. here is what I get after I autoinstalled a theme update?

    how do I fix it?

    Fatal error: Cannot redeclare plugin_is_active() (previously declared in /mounted-storage/home6a/sub001/sc14942-YBUS/www/bond/video/starwars/attache/wp-content/plugins/1-flash-gallery/fgallery.php:2606) in /mounted-storage/home6a/sub001/sc14942-YBUS/www/bond/video/starwars/attache/wp-content/themes/raindrops/functions.php on line 2808

  4. You have a conflict between your raindrops theme and your 1 flash gallery plugin. Deactivate the plugin using FTP – rename the 1-flash-gallery folder something else (like I’ve done above)

    Both your plugin and theme are using a plugin_is_active function which I believe is causing the conflict. You’ll need to contact the plugin or theme developer directly about this.

  5. I thank you so much for the help!

    I reinstalled all my content and rebuilt my core.
    the problem lies directly with 1 flash gallery, and since that caused a fatal error I won’t be using that plugin.

    my website is looking much better!

    are you a star wars fan?

  6. well, my site helps Stormtroopers understand all the details from the original costumes used in 1976 to film the 1977 release. your expertise helped to keep the site up and running!

  7. Hey there, I hope you can help me with a problem I keep having.

    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?

    Really hope you can help because I’m clueless here.

  8. 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.

    So maybe it’s the cache plugin?

  9. 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!!!

  10. 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

    How do I go about solving this?

  11. @George – it looks like you have an error with line 20 of your sidebar.php file in your WordPress theme. I’ve tried to find a copy of it to check out but no luck.

    Have you just updated WordPress? It’s possible that your theme won’t work with the latest version. What were you doing when you got the error message?

    @anna_b did you get your problem sorted?

  12. This is my error message: I screwed up.

    [16-Aug-2011 00:06:48] PHP Parse error: syntax error, unexpected ‘<' in /home/e7411092/public_html/WP/wp-content/themes/minimalist/functions.php on line 38

    [16-Aug-2011 00:12:35] PHP Fatal error: Cannot redeclare thematic_remove_generators() (previously declared in /home/e7411092/public_html/WP/wp-content/themes/minimalist/functions.php:134) in /home/e7411092/public_html/WP/wp-content/themes/thematic/functions.php on line 134

    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?

  13. @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.

    Hope that helps!

  14. I get this error on my web.

    Fatal error: Cannot redeclare __popular_posts() (previously declared in /home/content/i/html/wp-content/themes/fullscreen/functions.php:333) in /home/content/i/html/wp-content/themes/fullscreen/functions.php on line 574

    I have delete popular post plugin & reinstall my theme, and it solved just for a couples minutes. And next more minutes, this error still show again.

    Can you help me?

  15. i am getting this error…
    Fatal error: Cannot redeclare header_widget() (previously declared in /home/content/78/8059178/html/wp-content/themes/matala/functions.php:484) in /home/content/78/8059178/html/wp-content/themes/matala/inc/theme-options.php on line 208

    please help me . . . how to I find my FTP file?

    • hello, you have helped many people on this site…. how bout 1 more?!

      This is what I get, and it makes me sad : (

      Fatal error: Call to undefined function wp_is_mobile() in /home/content/24/9353524/html/wp-admin/index.php on line 2

  16. can you help me i got this error and i dont know what to do

    Fatal error: Call to undefined function wp_get_theme() in /home/iggyarts/public_html/wp-content/themes/evolve/library/functions/options.php on line 11

  17. I just received this error and now I can’t even log into my dashboard or get to my website! Can someone help??

    Fatal error: Cannot redeclare widget_contusmacalbum() (previously declared in /home/petergre/public_html/wp-content/plugins/mac-dock-gallery/macGallery.php:524) in /home/petergre/public_html/wp-content/plugins/mac-dock-gallery/macGallery.php on line 524

  18. Dear Siobhan

    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.

    Fatal error: Cannot redeclare new_excerpt_more() (previously declared in /home/content/70/9739270/html/wp-content/themes/twentytwelve/functions.php:443) in /home/content/70/9739270/html/wp-content/themes/twentytwelve/functions.php on line 463

    Can you please help?

  19. Hi,
    today I get this fatal error trying to enter my site after updating :

    Fatal error: Call to undefined function wp_get_current_user() in /home/magdale4/public_html/wp-content/plugins/atcontent/atcontent_post.php on line 182

    I’ve found file and line, but it’s black magic for me. Can you help me fix this problem?

    Text from troubleshooting file:

    function atcontent_guest_post_preview( $posts ) {
    global $wp_query;
    global $wp;

    $userid = wp_get_current_user()->ID;
    $ac_api_key = get_user_meta( $userid, “ac_api_key”, true );

    if ( $_GET[‘ac_guest_post’] != null ) {
    $gp_request = atcontent_api_guestposts_preview( $ac_api_key, $_GET[‘ac_guest_post’], site_url() );
    if ( $gp_request[“IsOK”] != true ) {
    return $posts;
    }
    global $wp_filter;
    remove_filter( ‘the_content’, ‘atcontent_the_content’, 1 );
    remove_filter( ‘the_content’, ‘atcontent_the_content_after’, 100);
    remove_filter( ‘the_excerpt’, ‘atcontent_the_content_after’, 100);
    remove_filter( ‘the_excerpt’, ‘atcontent_the_excerpt’, 1 );
    $accept_uri = admin_url(“admin.php?page=atcontent/guestpost.php&postid=” . $_GET[‘ac_guest_post’] . “&action=accept”);
    $decline_uri = admin_url(“admin.php?page=atcontent/guestpost.php&postid=” . $_GET[‘ac_guest_post’] . “&action=decline”);
    $post = new stdClass;
    $post->post_author = 1;
    $post->post_name = “ac_guest_post”;
    $post->guid = get_bloginfo(‘wpurl/ac_guest_post’);
    $post->post_title = ‘Preview ‘ . $gp_request[“Title”];
    $post->post_content = ‘[atcontent id=”‘ . $gp_request[“Post4gId”] . ‘”]’ .
    <<<END

  20. 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.

  21. 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.

Participate