Troubleshooting · Troubleshooting
How to Fix "Call to Undefined Function" Fatal Errors in WordPress
Short answer
A “Call to undefined function” fatal error means PHP tried to run a function that was not defined when the code ran, so WordPress stops loading that page. Find the exact function name, file and line in the error log, then fix the cause. In most cases you deactivate or update the plugin or theme named in the path, restore the missing file, or enable the PHP extension that provides the function.
Key takeaways
- The error means PHP could not find the named function at the moment the code called it.
- WordPress Recovery Mode, added in version 5.2, can pause the faulty plugin or theme so you can log in.
- The file path in the error usually names the plugin or theme folder that caused the failure.
- WordPress recommends PHP 8.3 or greater as of November 2026, and still works with PHP 7.4 and newer.
- PHP 8.2 security support ends on 31 December 2026, so an old PHP version can leave removed functions behind.
- Always back up the site before you edit wp-config.php, rename folders or update code.
What does “Call to undefined function” mean in WordPress?
It means PHP tried to run a function that was not defined when the code reached the call.
A fatal error is a PHP error that stops the script. WordPress cannot finish loading the page, so visitors often see “There has been a critical error on this website” instead of the page. The full message names the missing function, the file that called it and the line number.
The PHP manual says function_exists() returns true if the given function has been defined and false otherwise, which is the test PHP uses in effect at run time (function_exists()). If the name is not in the list of defined functions, the call fails.
Why does WordPress show this fatal error?
WordPress shows it when a plugin, theme or custom code calls a function that is missing, disabled or loaded too late.
The most common causes are a plugin or theme update that removed a file, a second plugin that used to define the function and is now inactive, a PHP extension that is not enabled, or code that calls a function removed in a newer PHP version.
WordPress.org says a fatal error is often caused by a plugin, theme or custom code and it prevents normal login or site operation (Recovery Mode). That is why the same error can lock you out of the dashboard as well as the front of the site.
A typo in the function name can cause the same message. PHP looks up the exact name in the call, so one wrong letter is enough to make a real function look missing.
| Cause | Clue in the error | First fix |
|---|---|---|
| Plugin or theme update removed a file | Path names that plugin or theme | Deactivate or update it |
| Required plugin is inactive | Function belongs to another plugin | Reactivate that plugin |
| PHP extension not loaded | Function name matches an extension | Ask the host to enable it |
| Code calls a removed function | Error started after a PHP update | Update the code or plugin |
| Typo in the function name | Name is close to a real function | Correct the spelling |
How do you read the full error message?
Read the log line, because it gives the function name, the file path and the line number in one place.
A typical line looks like this:
PHP Fatal error: Uncaught Error: Call to undefined function my_plugin_helper() in /wp-content/plugins/my-plugin/file.php:42
The name in brackets is the function PHP could not find. The path after “in” tells you which plugin or theme folder holds the calling code, and the number after the colon is the line to inspect.
Kinsta's server-error docs say fatal errors include PHP Fatal error and usually name the file and line where the problem happened, and a path under wp-content/plugins/ or wp-content/themes/ points to that plugin or theme (Troubleshooting - Server Errors). Start with that folder, not with a guess about the whole site.
If you only see the short “critical error” message on screen, turn on logging to get the full line. The next section shows the safe way to do that.
How do you turn on WordPress debug logging?
Add the debug constants to wp-config.php, then read wp-content/debug.log after you reload the broken page.
WordPress.org gives this exact set of lines for logging errors while hiding them from visitors (Debugging in WordPress):
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Put these lines before the line that reads “That's all, stop editing! Happy blogging.” in wp-config.php. WordPress.org says you must insert the code before that line.
With WP_DEBUG_LOG set to true, the log is saved to debug.log in the content directory, usually wp-content/debug.log. WordPress.org also notes that WP_DEBUG_LOG does nothing unless WP_DEBUG is enabled.
Back up the site first, using your host backup or a plugin guide such as how to back up WordPress. A wrong edit in wp-config.php can break the site further, so keep a copy you can restore.
How do you regain access with Recovery Mode?
Open the Recovery Mode link in the email WordPress sends to the site admin, then log in and deactivate the faulty item.
Recovery Mode is a built-in WordPress feature introduced in version 5.2, and WordPress activates it when it detects a fatal PHP error during a regular page load (Recovery Mode). The email goes to the administrator address and includes a link to log in with Recovery Mode active.
Faulty plugins or themes are paused just for your admin session, so you can log in safely. Your dashboard then loads with notices that point to the problem item.
Follow these steps in order:
- Check the admin inbox and spam folder for the WordPress email.
- Click the Recovery Mode link and log in.
- Go to Plugins or Appearance > Themes and deactivate the item named in the notice.
- Click “Exit Recovery Mode” in the admin toolbar and reload the site.
If no email arrived, check the spam folder first. WordPress.org warns that the email can be filtered or blocked if the server mail settings are not fully trusted, so a missing email does not mean the error is gone.
How do you find the plugin or theme that caused it?
Match the file path in the fatal error to a folder under wp-content/plugins or wp-content/themes.
The folder name right after plugins/ or themes/ is the item to suspect first. If the path names a file in wp-content/plugins/example-plugin/includes/helper.php, the plugin is example-plugin.
If the path names a theme file, the theme is the suspect. If it names wp-content/mu-plugins/ or a file added by custom code, the custom code is the suspect instead.
When the error started right after an update, note the item you updated last. A plugin update can remove a helper file, rename a function or drop support for an old PHP version, and the next page load is when the missing call appears.
SiteGround's error-log guide says each log entry holds a timestamp, a description, the full path of the file and the line where the error occurs (How to Find and Access WordPress Error Logs). Use all four parts together before you change anything.
How do you fix it by deactivating plugins and themes?
Deactivate the suspect item first, reload the site, and if the error clears, you have found the cause.
In Recovery Mode, go to Plugins, find the suspect plugin and click Deactivate. For a theme, go to Appearance > Themes and switch to a default theme such as Twenty Twenty-Five.
If you cannot reach the dashboard at all, rename the folder by FTP or your host file manager. WordPress.org says you may deactivate a plugin by renaming its folder, for example /wp-content/plugins/hello-dolly to wp-content/plugins/hello-dolly-1/ (Recovery Mode).
Use this order when the suspect is not clear:
- Rename the whole
pluginsfolder toplugins.holdto switch every plugin off at once. - Reload the site and confirm the error is gone.
- Rename the folder back to
plugins. - Reactivate plugins one at a time in the dashboard until the error returns.
The plugin that brings the error back is the one to update, replace or remove. Do not leave all plugins off as a fix, because the site needs them to work as built.
How do you fix a missing or disabled PHP extension?
Check whether the extension that provides the function is loaded, then ask your host to enable it or install it.
Some functions come from PHP extensions, not from WordPress code. A call to mysqli_connect() fails if the MySQLi extension is not loaded, and a call to curl_init() fails if cURL is not loaded.
The PHP manual says extension_loaded() returns true if the named extension is loaded and false otherwise, and you can list loaded extensions with php -m (extension_loaded()). Your host support can run that check, or you can see the list in your hosting panel if it shows PHP details.
WordPress recommends PHP 8.3 or greater as of November 2026, and WordPress also works with PHP 7.4 and newer in older environments (Requirements). If your host still runs PHP 7.4, ask about moving to a supported version before you change code.
For help with that change, see how to update PHP for WordPress without breaking the site. Do not edit server settings you cannot reverse, and keep a backup before the switch.
How do you fix code that calls a removed or renamed function?
Replace the old function call with the current one from the plugin, theme or PHP docs, and update the item that owns the code.
Old code often calls functions that PHP removed in a later version. The old mysql_* functions are the classic case, and modern code uses MySQLi or PDO instead. A plugin that still calls a removed function needs an update from its author.
First check for an update in Dashboard > Updates. If an update exists, install it and reload the page. If no update exists, contact the plugin or theme author with the exact error line and ask for a version that supports your PHP version.
The PHP manual says functions need not be defined before they are referenced, except when a function is conditionally defined (User-defined functions). That rule matters here: a function defined inside an if block or inside another function does not exist until that block runs, so a call placed before it fails.
If the bad call is in your own custom code, move the definition so it runs before the call, or guard the call with a check.
The PHP manual shows function_exists() as the test for whether a function has been defined (function_exists()). Use it only as a guard for optional features, not as a way to hide a broken plugin.
How do you check the fix worked?
Reload the page that failed, log in to the dashboard, and check the log for a new fatal error.
Work through this short check list:
- Reload the front page and the page that showed the error.
- Log in at /wp-admin/ and open the Plugins screen.
- Open a post and a page that use the fixed plugin or theme.
- Reload the site after you exit Recovery Mode.
- Open
wp-content/debug.logand look for a fresh “Call to undefined function” line.
If the pages load and no new fatal error appears in the log, the fix held for that request. If the error returns only on one page, the problem is in the code that page runs, such as a shortcode, widget or template file.
Turn debug logging off when you finish. Set WP_DEBUG back to false in wp-config.php, because WordPress.org says it is not recommended to use WP_DEBUG on live sites (Debugging in WordPress).
When should you contact your host?
Contact your host when the error names a PHP extension, a PHP version or a server log you cannot reach.
Ask the host to check the server error log, confirm which PHP version and extensions are active, and enable a missing extension if your plan allows it. Give them the exact error line, the time it happened and the URL that failed.
Also contact the host if Recovery Mode email never arrives, if you cannot reach files by FTP or the file manager, or if the error returns right after you restore a backup. Those signs point to a server setting rather than a single plugin.
PHP version dates help you frame the request. PHP lists security support for 8.2 until 31 December 2026 and for 8.3 until 31 December 2027 (Supported Versions).
Support for 8.4 runs until 31 December 2028, while 8.5 was released on 20 November 2025 with security support until 31 December 2029. A site on a version near its end date should move to a supported release.
If the host says the PHP version is fine and no extension is missing, send the error to the plugin or theme author next. The 500 internal server error guide covers the wider fatal-error case if your site shows a blank 500 page instead of this message.
What mistakes should you avoid?
Do not edit live files without a backup, do not hide the error, and do not delete the plugin folder before you know which item caused it.
Avoid these common errors:
- Editing wp-config.php in a word processor, which can add hidden characters to the file.
- Setting
WP_DEBUG_DISPLAYtotrueon a live site, which shows error details to visitors. - Deleting a plugin folder instead of renaming it, which removes its files before you can test a reinstall.
- Updating every plugin at once after the fix, which hides which update caused the problem.
- Leaving debug logging on after the fix, which fills the log and can expose paths.
Keep a note of the function name, the file path and the fix that worked. That note makes the next error faster to solve, and it gives the plugin author or host the exact detail they need.
For related checks, see how to find abandoned WordPress plugins if the faulty plugin has no recent update.
Also check WordPress minimum requirements if you need to confirm the PHP version your site should run.
Frequently asked questions
Is "Call to undefined function" the same as a 500 error?
It can cause a 500 error, but it is not the same thing. The undefined function message names the exact PHP function that was missing, while a 500 error is a general server message that hides the cause. Turn on WordPress debug logging to see the full fatal error line, then fix the plugin, theme, extension or code it names.
Can I fix this error from the WordPress dashboard?
Yes, if you can log in or use Recovery Mode. Open the Recovery Mode link from the admin email, then go to Plugins or Appearance and Themes and deactivate the item named in the notice. If the dashboard will not load at all, rename the suspect plugin folder by FTP or your host file manager, then log in and test again.
Why did the error appear after a plugin update?
An update can remove a helper file, rename a function or drop support for an old PHP version. Code that still calls the old name then fails on the next page load. Check for a newer version of the same plugin, read its changelog for removed functions, and contact the author if no update fixes the call.
Does updating PHP fix an undefined function error?
It can fix it when the function was added in a newer PHP version or provided by an extension in that version. It can also cause it when old code calls a function that the newer PHP version removed. Check the error line first, confirm the PHP version your plugin supports, and back up before you change PHP versions.
Should I leave WP_DEBUG on after fixing the error?
No. Turn WP_DEBUG back to false once the site works and the log shows no new fatal error. Leaving it on can show error details to visitors and fill the debug log with notices. Keep WP_DEBUG_LOG on only while you are still watching for a repeat of the same error.
Sources
- Debugging in WordPress WordPress.org
- Recovery Mode WordPress.org
- function_exists - PHP Manual PHP.net
- User-defined functions - PHP Manual PHP.net
- Supported Versions - PHP PHP.net
- Requirements WordPress.org
- Troubleshooting - Server Errors Kinsta Docs
- How to Find and Access WordPress Error Logs SiteGround
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
