Safely and easily call functions that may not be available (such as those provided by a plugin that gets deactivated)
As of April 2026, Safe Function Call is a WordPress error plugin with 10 active installations and a 5/5 rating from 1 reviews. It has been downloaded 4.8K+ times in total. Requires WordPress 1.5+ and PHP false+. Available on WordPress.org since 2009. Top alternative: WP Maximum Execution Time Exceeded.
Safely call a function, class method, or object method in a manner that doesn’t generate errors if those plugins cease to exist.
Various helper functions are provided that provide handy variations of this theme:
_sfc(): Safely call a function and get its return value_sfce(): Safely call a function and echo its return value_sfcf(): Safely call a function; if it doesn’t exist, then a fallback function (if specified) is called_sfcm(): Safely call a function; if it doesn’t exist, then echo a message (if provided)Let’s assume you had something like this in a template:
<?php list_cities( 'Texas', 3 ); ?>
If you deactivated the plugin that provided list_cities(), your site would generate an error when that template is accessed.
You can instead use _sfc(), whi…
| WordPress | 1.5+ requiredTested up to 6.8.5 |
| PHP | false+ required |
Highlights:
This minor release sanitizes the output of the callback return value in _sfce() and the $msg_if_missing argument value to _sfce(), notes compatibility through WP 6.8+ and PHP 8.3+, and updates copyright date (2025).
Details:
_sfce()$msg_if_missing argument value to _sfcm()Plugin data sourced from WordPress.org. Analysis and metrics by PluginSift.