Website support, maintenance and fixes for UK businessesCall 0208 088 8371info@websupportservices.co.uk

HomeWordPress errorsFix the WordPress call to undefined function error

Fix the WordPress call to undefined function error

A call to undefined function error means PHP reached code that tried to run a function which was not available at that point in the request. In WordPress, the cause is often a plugin, theme, dependency or PHP compatibility problem rather than WordPress core itself.

The message you might see

Fatal error: Uncaught Error: Call to undefined function

Different wording, or a file path in the message? Paste it into our free error finder to see which plugin or theme it comes from.

What a call to undefined function error means

A typical message begins Fatal error: Uncaught Error: Call to undefined function and then names the missing function, file and line. Because the error is fatal, PHP stops processing that request.

The function may genuinely not exist, but it can also exist in another file that failed to load, a plugin that has been deactivated, a PHP extension that is unavailable, or code that is being executed earlier than its dependency expects.

The complete error and stack trace matter. A path inside wp-content/plugins usually identifies plugin code involved in the failure, while a path inside the active theme can point to theme or custom functions. The function name itself can also reveal which component is expected to provide it.

Common causes of undefined functions in WordPress

Undefined function errors commonly appear immediately after an update, migration, PHP version change, plugin deactivation or custom code deployment.

  • A plugin dependency is missing or inactive. An add-on may call a function supplied by a main plugin without first checking that the main plugin loaded.
  • A theme calls a plugin function directly. If the plugin is disabled, the theme can fail unless the call is guarded appropriately.
  • A required PHP file was not loaded. Incorrect include paths, failed autoloading or code running at the wrong WordPress hook can leave a function unavailable.
  • A PHP extension or function is unavailable. Code may rely on a server extension that is not installed or enabled on the current hosting environment.
  • Older code is incompatible with the current PHP version. Functions removed from PHP can appear as undefined after a server upgrade.
  • There is a spelling or namespace error. Custom code can call the wrong function name or resolve a namespaced function differently from the developer's intention.

How to fix call to undefined function safely

Take a full backup of the files and database before changing plugins, themes, PHP settings or code.

  1. Read the complete fatal error and record the missing function, first relevant file path and line number. Avoid editing a file solely because it appears later in the stack trace.
  2. If the fault began after updating one plugin or theme, check for another available update and verify that any required parent plugin or dependency is still installed and active.
  3. If wp-admin is unavailable and the first failing path clearly belongs to one plugin, rename that plugin's directory under wp-content/plugins using SFTP or your host's file manager. If the site loads again, you have isolated the component, but you still need to establish why the function was unavailable before reactivating it.
  4. If the site uses custom code, check whether the function is called before the file or WordPress hook that defines it. PHP's function_exists() can be appropriate when a feature is genuinely optional:
    if (function_exists('example_function')) {
        example_function();
    }
    Do not use this merely to hide a missing required dependency. Required functionality should be restored or the dependent code should fail in a controlled way.
  5. Check the server PHP version and required extensions, particularly if the error appeared after migration or a PHP upgrade. WordPress currently recommends PHP 8.3 or greater, but every active plugin, theme and custom integration still needs to be compatible with the PHP version actually in use.
  6. For a harder fault, enable logging without displaying errors publicly:
    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    Review the relevant entries in the log, then disable debugging when finished.

Do not replace WordPress core files or invent a replacement function unless you have confirmed exactly which component is supposed to provide it.

When an undefined function error needs developer help

Stop if the missing function belongs to bespoke code you do not recognise, several components depend on it, or the site only fails during checkout, scheduled jobs, API requests or other paths you cannot safely reproduce. Also stop if disabling the apparent plugin merely moves the fatal error into another dependent component.

Compatibility faults after a PHP upgrade should normally be corrected in the affected plugin, theme or custom code rather than worked around by suppressing fatal errors.

Web Support Services offers an Emergency Fix for £249 per incident with a response within 2 working hours. For ongoing updates and technical support, care plans start from £59 a month.

Common questions

Answers to the questions we hear most about this.

What causes call to undefined function in WordPress?

Typical causes include a missing or inactive plugin dependency, incompatible custom code, a required file loading too late, an unavailable PHP extension, a removed PHP function or a spelling or namespace mistake.

Can I disable the plugin named in the fatal error?

If the error path clearly points to a plugin and you have a full backup, temporarily disabling that specific plugin can be a useful diagnostic step. Check whether other site functions depend on it before leaving it disabled.

Does function_exists fix an undefined function error?

It can safely guard optional functionality, but it is not a proper fix when the function is required. In that case you need to restore the dependency, correct the load order or update the incompatible code.

Site down or showing an error?

Call us now. Emergency Fix is £149 with a response within 2 working hours, and no fix means no fee.

Get website support