If you get an error like this, there is a plugin or another function called in your theme that you…


Fix WordPress Fatal error: Call to undefined function

If you get an error like this, there is a plugin or another function called in your theme that you do not have. How do you fix this? There are some ways: delete the code, correct errors, get the necessary plugin or update WordPress if necessary. In this WordPress quick tip, we will show how to correct errors with a conditional label and a PHP function known as: function_exists.

How to Fix Fatal error: Call to undefined function error:

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

Leave a Reply

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