Your site was fine an hour ago. Now every page shows a critical error notice and wp-admin will not load.
The WordPress fatal error: call to undefined function means PHP hit a function call with nothing declared behind it, so it killed the request on the spot.
Usual suspects: a missing PHP extension, a deactivated plugin, wrong hook timing, or a host that just bumped you to PHP 8.4.
This guide covers what the error message actually tells you, how to read debug.log and find the failing file, the fix for each root cause, and how to get back in when FTP is your only door.
What Is the WordPress Fatal Error: Call to Undefined Function
Call to undefined function is a PHP fatal error that fires when PHP reaches a function call with no matching declaration loaded in memory at execution time. PHP stops the entire request on the spot. WordPress catches the shutdown and prints a critical error notice.
The error kills the whole request, not just the block it sits in. Everything queued after that line never runs.
Since WordPress 5.2 (May 2019), core registers a shutdown handler through registershutdownfunction. That handler is why most sites now show the “there has been a critical error on this website” message rather than a blank page.
A pure blank white screen still happens when PHP dies before the handler loads, or when the crash comes from memory exhaustion at the OS level.
| Where it surfaces | What you get |
|---|---|
| Browser output | Critical error notice, no file path |
debug.log | Full error message, file path, line number, and stack trace |
| Server error log | Same trace, timestamped by PHP-FPM or Apache |
| Recovery Mode email | Offending plugin name plus a one-time login link |
Two neighbouring errors get confused with this one constantly. Call to undefined method means the object exists but the method does not. Call to a member function on null means the variable was never populated.
Have you seen the latest WordPress statistics?
Discover the latest WordPress statistics: market share, security trends, performance data, and revenue insights that shape the web.
Check Them Out →Neither is a parse error, which stops PHP before execution even starts.
Anatomy of the Error Message
A full line looks like this: PHP Fatal error: Uncaught Error: Call to undefined function acmegetsettings() in /home/site/publichtml/wp-content/themes/child/functions.php:142
File path and line: the call site, not the declaration site. Line 142 is where the function was invoked, not where it was supposed to be defined.
Uncaught Error prefix: PHP 7 moved fatals into the Error class, which implements Throwable but does not extend Exception. A catch (Exception $e) block will not catch it.
Stack trace: read it bottom-up. The last frame is the entry point, the first frame is the failing call.
What Causes Call to Undefined Function Errors in WordPress
Seven root causes produce this error: a missing PHP extension, a WordPress function called too early in the bootstrap, a deactivated plugin whose function is still referenced, a PHP version that removed the function, a typo or namespace slip, a corrupted update, and a conditional declaration that never ran.
Ranked by how often each one turns out to be the actual culprit:
- Missing PHP extension. Most common on migrations and freshly provisioned servers
- Wrong hook timing. The function exists but has not loaded yet at the moment of the call
- Deactivated plugin. Snippets in functions.php outlive the plugin they depend on
- PHP version removal. Host bumps PHP, the function disappears
- Typo or namespace error. Unqualified calls inside a namespaced file resolve to the wrong scope
- Corrupted or partial update. An interrupted plugin update leaves half the files on disk
- Conditional declaration. A function wrapped in an
ifblock that evaluated false
Patchstack’s State of WordPress Security 2025 found 96% of disclosed vulnerabilities sat in plugins and 4% in themes, with only seven in core. The same distribution holds for fatal errors: the fatal error is almost never core’s fault.
Average US WordPress site runs 21 plugins, according to 2025 SQ Magazine data. Twenty-one separate codebases, each declaring functions the others can call.
Which PHP Extensions Trigger Undefined Function Errors
Six PHP extensions account for the majority of extension-related fatals in WordPress: curl, mbstring, gd, xml, bcmath, and zip. Every function in those extensions becomes undefined the moment the module is absent from the PHP build, regardless of the site’s own code.
| Extension | Function that dies | What breaks |
|---|---|---|
php-curl | curl_init() | Payment gateways, license checks, remote fetches |
php-mbstring | mb_strlen(), mb_substr() | Multibyte titles, core sanitization |
php-gd | imagecreatefromjpeg() | Thumbnail regeneration, media uploads |
php-xml | simplexml_load_string() | WXR importer, RSS parsing |
php-bcmath | bcadd(), bcmul() | WooCommerce Subscriptions, tax calculations |
The zip extension belongs in the same group. Without ZipArchive, plugin installs and UpdraftPlus backups fail outright.
WordPress itself needs mysqli, curl, json, mbstring, xml, and zip. WooCommerce adds bcmath, gd or imagick, and intl on top of that.
Three ways to verify what is loaded:
- Tools > Site Health > Info, which flags missing required modules as critical
php -mover SSH, the fastest check when you have terminal access- A temporary
phpinfo()file, useful when the php.ini location is also unknown
Installing differs by panel. cPanel exposes it under Select PHP Version, Plesk under PHP Settings, Ubuntu through apt install php8.3-curl, and Kinsta or Cloudways through a support request. Restart PHP-FPM after any install or the change never takes effect.
PHP Version Removals That Break Functions
The pattern: a function deprecated in one release gets deleted in the next major, and every plugin still calling it fatals the moment the host upgrades.
createfunction()andeach(): removed in PHP 8.0moneyformat(): removed in PHP 8.0utf8encode()andutf8decode(): deprecated in 8.2, removed in 8.4- The entire
mysql*family: removed in PHP 7.0
WordPress core research counted createfunction in over 5,500 plugins at the time PHP 8.0 shipped, several with millions of installs. Make WordPress Core logged 48 backwards-incompatible changes in PHP 8 core and 166 across the full release.
Checking Compatibility Before the Upgrade
WP Engine’s PHP Compatibility Checker plugin has been abandoned since 2023 and only scans up to PHP 8.0. Run PHPCS with the PHPCompatibilityWP ruleset against /wp-content/ instead.
How the WordPress Load Order Causes Undefined Function Errors
WordPress loads functions in stages, not all at once. A function called before its stage produces an undefined function fatal even though the file containing it sits on disk and the plugin is active. Timing, not availability, is the failure.
The sequence runs wp-load.php, then wp-settings.php, then mu-plugins, then plugins, then pluginsloaded, then theme functions, then init, then wp.
| Stage | What becomes callable |
|---|---|
wp-config.php | Nothing WordPress-specific. Constants only |
plugins_loaded | Pluggable functions: is_user_logged_in(), wp_get_current_user() |
init | Post types, taxonomies, most core APIs |
wp | Conditional tags: is_page(), is_single(), is_home() |
Everything inside pluggable.php loads late by design, so plugins can override it. Calling getcurrentuserid() from an mu-plugin fails for exactly that reason.
The defensive pattern is a functionexists() guard around any call whose timing you cannot control:
if ( functionexists( 'wcgetproduct' ) ) { $product = wcgetproduct( $id ); }
Move the call to a later hook when the guard silently skips work you actually need. Guards prevent crashes. They do not fix timing.
How to Read the Error Log and Identify the Failing File
Reading the log converts a generic critical error screen into a file path, a line number, and a plugin name. Three constants in wp-config.php produce that output: WPDEBUG, WPDEBUGLOG, and WPDEBUGDISPLAY set to false so visitors see nothing.
Drop this above the “stop editing” comment:
define( 'WPDEBUG', true ); define( 'WPDEBUGLOG', true ); define( 'WPDEBUGDISPLAY', false );
Where the output lands:
/wp-content/debug.logfor the WordPress-level record/var/log/nginx/error.logor the cPanel errorlog file for the server-level record- The recovery mode email, subject line “Your Site is Experiencing a Technical Issue”
Read the trace from the bottom up. The bottom frame is the request entry point, the frames above it walk toward the failing call, and the plugin folder name in the path tells you the owner.
Large logs get unreadable fast. grep -n "undefined function" wp-content/debug.log | tail -20 pulls the last twenty occurrences with line numbers.
Query Monitor, maintained by John Blackbourn at Human Made, attributes each PHP error to a specific component. Oxygen’s testing measured 10 to 100 milliseconds of added page generation time and roughly 10% higher memory use, so keep it on staging rather than production.
Full setup detail sits in the guides on reading the WordPress error log and displaying PHP errors on screen.
How to Fix Call to Undefined Function Errors
The repair path runs in three steps: identify the function name from the log, determine who owns it (core, plugin, theme, or PHP extension), then apply the fix that matches that owner. Guessing at fixes before identifying the owner wastes hours.
Owner to fix, matched:
- Plugin function: reactivate the plugin, or delete the orphaned call from the theme’s functions.php file
- PHP extension: install the module, restart PHP-FPM, reload
- Wrong timing: move the call to
initor later - Removed by PHP version: roll PHP back one version in the hosting panel, then update the plugin properly
- Corrupted core: reupload from a fresh WordPress.org download, excluding wp-content and wp-config.php
The rollback is a holding action, not a fix. PHP 8.1 lost security patches on December 31, 2025, and 34.2% of WordPress sites still ran PHP 7.4 or older in late 2025 according to WordPress usage data.
Reuploading core files is safe because core ships no user data. Editing them is a different matter, and core file edits get wiped by the next update anyway.
Fixing Without Dashboard Access
Over FTP or SFTP: rename /wp-content/plugins/ to plugins-off. Every plugin force-deactivates and the site loads.
Rename the folder back, then rename individual plugin folders one at a time until the error returns. That plugin is the offender.
Theme switch through phpMyAdmin: edit the template and stylesheet rows in wpoptions to twentytwentyfour. Useful when the theme is the source of the error.
Over WP-CLI:
wp plugin deactivate --all --skip-pluginswp theme activate twentytwentyfour --skip-themeswp core verify-checksums
Kinsta, WP Engine, and SiteGround all keep automatic daily snapshots. A one-click restore beats manual debugging when the site is a revenue-generating store.
Which WordPress Functions Most Commonly Throw This Error
Two groups dominate: plugin API functions called while the plugin is inactive, and core admin functions that live in files WordPress does not load on the front end. Both produce identical error text and need completely different fixes.
| Function | Owner | What it needs |
|---|---|---|
get_field(), the_field() | Advanced Custom Fields | Plugin active (2M+ installs, often missing on staging copies) |
WC(), wc_get_product() | WooCommerce | Plugin active, called after plugins_loaded |
elementor_theme_do_location() | Elementor Pro | Pro license active, not just the free Elementor plugin |
dbDelta() | WordPress core | require_once ABSPATH . 'wp-admin/includes/upgrade.php'; |
wp_handle_upload() | WordPress core | require_once ABSPATH . 'wp-admin/includes/file.php'; |
The core admin functions catch people out because they work fine while testing in wp-admin. Move the same code to a front-end template or a cron callback and it fatals immediately.
mediahandleupload() needs both file.php and media.php required. Missing the require produces this error, while a wrong path produces a failed to open stream warning first.
wpgetcurrentuser() is the single most common one in mu-plugins. It lives in pluggable.php, which loads well after mu-plugins run.
How to Prevent Undefined Function Errors in Custom Code
Four defensive habits stop this error before deployment: guard every external call with functionexists(), declare dependencies in the plugin header, check extensions with extensionloaded(), and scan the codebase with PHPCS before the PHP version changes underneath you.
Guards cost one line. Debugging a dead checkout page at 11pm costs considerably more.
| Guard | What it checks | Use it for |
|---|---|---|
function_exists() | Function is declared right now | Plugin API calls, pluggable functions |
class_exists() | Class is available or autoloadable | Third-party libraries, WooCommerce classes |
extension_loaded() | PHP extension is compiled and enabled | curl, gd, bcmath, intl calls |
defined() | Constant exists | Version gating, plugin detection |
Declare dependencies in the header. WordPress 6.5 shipped the Requires Plugins field, which takes a comma-separated list of WordPress.org slugs and blocks activation until those plugins are active.
That ticket (#22316) sat open in Trac from 2012 until February 2024. Eleven years of plugin authors writing their own dependency checks by hand.
Pair it with Requires PHP in the same header block. WordPress refuses to activate the plugin on an older runtime rather than letting it fatal on first load.
The namespace trap: inside a namespaced file, an unqualified call resolves to the current namespace first, then falls back to global. Custom functions get no fallback, so AcmePlugingetfield() throws undefined function even though ACF is active. Prefix the call with a backslash.
Scan before you deploy:
- PHPCS with the PHPCompatibilityWP ruleset, pointed at
/wp-content/ - A staging copy running the exact PHP version and extension set as production
- WPDEBUGLOG enabled on staging, then browse every key template
WordPress Plugin Directory figures from late 2025 put 89.3% of active plugins on PHP 8.1+ support, but only 67.2% fully supporting PHP 8.3. That gap is where undefined function errors live.
Worth separating from the neighbouring problem: a missing semicolon produces a syntax error at compile time, which PHPCS catches instantly. Undefined function errors survive compilation and only fire at runtime.
How to Restore a Site Locked Out by the Error
WordPress emails a one-time recovery link to the administration address when a plugin or theme fatals. That link expires after 24 hours and a fresh one goes out every 24 hours while the error persists. Recovery mode pauses the offending extension and grants wp-admin access.
When the email never arrives:
- Set
define( 'RECOVERYMODEEMAIL', 'you@domain.com' );in wp-config.php over SFTP - Check spam, since transactional mail from a broken site routinely lands there
- Hit
yoursite.com/wp-login.php?action=enteredrecoverymodemanually
The catch on the constant: WordPress will not send a second email until the previous one expires, so expect to wait out the full 24 hours.
Fatals originating in core, wp-config.php, or PHP-FPM itself never reach the handler. Those still render a blank page with no email at all.
Restoring from backup, ranked by speed:
- Host-level snapshot. Kinsta, WP Engine, and SiteGround all keep automatic daily restore points
- UpdraftPlus, sitting on over 3 million active installs and restoring in three clicks
- BlogVault, installed on 450,000+ sites and storing backups off-server so a dead host does not take the backup with it
A site that hangs on the update screen instead of erroring has a leftover .maintenance file, which is a different problem with a one-file fix.
Clear the caches or the fix stays invisible. Zend OPcache holds compiled bytecode of the broken file, and Redis or Memcached hold the object cache built while the site was failing.
Run opcachereset() or restart PHP-FPM, flush Redis, purge the page cache, then purge the CDN. Visitors keep seeing the cached error screen otherwise.
Verify with Tools > Site Health and a hard reload in a private window. Logged-in sessions bypass page cache and hide a problem that is still live for everyone else.
Fatal Error Types Related to Call to Undefined Function
Five fatal errors get mistaken for undefined function calls. Two are declaration problems, two are resource ceilings, and one is a null value reaching an object operator. Each carries a distinct message and a distinct fix, so matching the message correctly saves the entire diagnostic pass.
| Message | Root cause | Category |
|---|---|---|
| Call to undefined method | Object loaded, method absent | Version mismatch |
Call to a member function on null | Variable never populated | Unchecked return value |
| Cannot redeclare function | Two declarations with the same name | Duplicate include |
| Allowed memory size exhausted | Script exceeded the memory limit | Resource limit |
| Maximum execution time exceeded | Script ran past the execution timeout | Resource limit |
Cannot redeclare is the exact inverse of this article’s error. One says the function is missing, the other says it exists twice, and both usually trace back to the same snippet pasted into the wrong file. The cannot redeclare fatal gets fixed by deleting the duplicate, not by adding a guard.
Memory exhaustion looks identical from the browser and is completely unrelated to declaration state. WordPress defaults WPMEMORYLIMIT to 40M on single sites and 64M on multisite, with WPMAXMEMORYLIMIT at 256M for admin requests.
WP Engine raises those ceilings to 256MB for all requests and 512MB in wp-admin across its platform. Reading the “tried to allocate” figure in the allowed memory size message tells you whether the site is starved or leaking.
Memory exhaustion also kills PHP before the WordPress shutdown handler runs, which is why it produces a true blank screen while undefined function errors produce the critical error notice.
Timeouts report nothing about code correctness. A max</em>execution<em>time timeout means a slow query or a stalled remote request, and the same page loads fine at a lower traffic level.
Server-level failures sit one layer above all of this. A crashed PHP-FPM pool returns a 500 status from the web server, with nothing written to debug.log at all.
The front-end equivalent lives in the browser console rather than the error log. The jQuery is not defined error follows the same logic in JavaScript: a call reaching for something that never loaded, just on the other side of the request.
FAQ on WordPress Fatal Error: Call to Undefined Function
What does call to undefined function actually mean?
PHP reached a function call with no matching declaration loaded in memory. The function may exist on disk, but it was not available at that moment, so PHP terminated the request immediately.
Why did the error appear right after a PHP upgrade?
PHP 8.0 removed createfunction(), each(), and moneyformat(). PHP 8.4 removed utf8encode(). Any plugin still calling those fatals on first page load. Roll the version back in your hosting panel, then update the plugin.
How do I find which plugin caused it?
Enable WPDEBUGLOG, then read the file path in /wp-content/debug.log. The plugin folder name sits in that path. The recovery mode email names the offender directly when WordPress catches the fatal.
Can I fix this without FTP access?
Yes. Use your host’s file manager, phpMyAdmin, or SSH with WP-CLI. wp plugin deactivate --all --skip-plugins clears every plugin without touching the dashboard.
Does a functionexists() guard actually fix it?
It stops the crash. It does not restore the missing functionality. If the guard silently skips work you need, the real fix is reactivating the plugin or moving the call to a later hook.
Why does the function work in wp-admin but not on the front end?
Core admin functions live in files WordPress loads only for admin requests. dbDelta() and wphandleupload() both need a manual requireonce from wp-admin/includes/ before front-end or cron use.
Is this the same as the white screen of death?
Not quite. Since WordPress 5.2, the shutdown handler catches most fatals and prints a critical error notice. A pure blank page usually points at memory exhaustion or a crash before the handler loads.
How do I check which PHP extensions are installed?
Tools > Site Health > Info lists loaded modules and flags missing required ones. Over SSH, php -m is faster. Restart PHP-FPM after installing anything, or the change never registers.
Will reinstalling WordPress fix it?
Only when core files are corrupted. Run wp core verify-checksums first. If checksums pass, the problem sits in a plugin, theme, or PHP extension, and reuploading core changes nothing.
How do I stop this happening again?
Declare dependencies with the Requires Plugins and Requires PHP headers. Test PHP upgrades on staging with matching extensions. Keep WPDEBUGLOG on with display off, and check memory-related fatals separately.
Conclusion
Every WordPress fatal error: call to undefined function resolves the same way: name the function, name its owner, apply the matching fix. Skip the first two steps and you are guessing.
The stack trace does most of the work. Read it bottom-up, find the plugin folder in the file path, and the owner is obvious within seconds.
Turn WPDEBUG_LOG on permanently with display off. A site that logs quietly for months costs nothing and saves the one afternoon it matters.
Then build the habit that actually prevents repeats: a staging copy running identical PHP and extensions, plus Requires PHP` declared in every custom plugin you ship.
Fatals stop being emergencies once the log is already there when you need it.


