X

Fix WordPress Fatal error: Call to undefined function

If you get an error like this, there is a plugin or other function called in your theme which you don’t have. How do you fix this? There are a few ways: remove the code, error proof it, get the necessary plugin, or upgrade WordPress if necessary. In this quick WordPress tip post we’ll go over how to error proof these with a conditional tag and PHP function known as: function_exists.

If you get an error such as Fatal error: Call to undefined function the_title_attribute() you can simply replace any instance of the_title_attribute with the following:

<?php if (function_exists('the_title_attribute')) { the_title_attribute(); } ?>

In this case, you could also take it one step further by adding an else statement.

<?php if (function_exists('the_title_attribute')) { the_title_attribute(); } else { the_title(); } ?>

Before trying a new theme on a production site, make sure to preview your theme first, and then work out all the errors (if any).

Comments   Leave a Reply

  1. hello,
    i get this error like :
    Fatal error: Call to undefined function wp_convert_hr_to_bytes() in /home/owakai/public_html/wp-includes/default-constants.php on line 33

    can you suggest any solution

  2. I’m really new to this…only dabbled in websites in college..trying to get this up for portfolio…what can I do to fix this?
    Fatal error: Call to undefined function wp_pagenavi() in /home/content/77/9421577/html/wordpress

    Thank you

  3. Doug Rekenthaler November 6, 2009 at 3:00 pm

    I’m suddenly getting this error message:

    Fatal error: Call to undefined function feed_content_type() in /home7/inspird6/public_html/wp-includes/feed.php on line 8

    I have replaced my feed.php file with the original WP source code and still am getting this error. Am I missing something?

  4. links for 2009-06-30 | BlueWave Media June 30, 2009 at 9:01 am

    […] Fix WordPress Fatal error: Call to undefined function | Theme Lab If you get an error like this, there is a plugin or other function called in your theme which you don’t have. How do you fix this? There are a few ways: remove the code, error proof it, get the necessary plugin, or upgrade WordPress if necessary. In this quick WordPress tip post we’ll go over how to error proof these with a conditional tag and PHP function known as: function_exists. (tags: thethemelab wordpress conditionaltag function) […]

  5. Hi ive just used:

    And it worked for that file where i was previously getting the Fatal error.

    Im now trying it for 2 sidebars of my theme so that i can place them into their own .php files.

    The sidebars are named leftsidebar and rightsidebar, so i use the code as above and put in get_leftsidebar and get_rightsidebar but it goes wrong somehow and the layout gets messed up, im not sure where i may be making the mistake here though, any ideas please?

    Thanks

    John

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!