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.
- 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.
- 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.
- 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.
- 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:
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.if (function_exists('example_function')) { example_function(); } - 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.
- For a harder fault, enable logging without displaying errors publicly:
Review the relevant entries in the log, then disable debugging when finished.define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);
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.