Fatal Error: Call to undefined function get_current_site() in Seraphinite Accele
-
Hello,
I’m encountering a critical fatal error when using the Seraphinite Accelerator plugin. The plugin causes the site to crash with the following error:
Fatal error: Uncaught Error: Call to undefined function get_current_site()
in /wp-content/plugins/seraphinite-accelerator/cache_obj.php:189Issue:
After enabling Object Cache in Seraphinite Accelerator, the site crashes with:Fatal error: Uncaught Error: Call to undefined function get_current_site()Root Cause:
The plugin’sWP_Object_Cacheclass assumes a Multisite environment and callsget_current_site()(a Multisite-only function) without checkingis_multisite()orfunction_exists().Affected Code:
Incache_obj.php, the_init()method tries to initialize$this->curSiteusingget_current_site(), which fails on single-site WordPress.This error occurs because the plugin’s
WP_Object_Cache->_init()method callsget_current_site()too early — before WordPress has fully initialized the multisite environment.🔧 Steps to Reproduce:- Install and activate the Seraphinite Accelerator plugin.
- Access any page on the site (including admin dashboard).
- The error appears immediately.
🖥️ Environment:
- WordPress Version: [Insert version – e.g., 6.5]
- PHP Version: [e.g., 8.1]
- Multisite: Yes (subdirectory install)
- Plugin: Seraphinite Accelerator v[insert version if available]
📁 File Involved:
/wp-content/plugins/seraphinite-accelerator/cache_obj.php, line 189:$this -> curSite = get_current_site();✅ Suggested Fix:
The
_init()method should check whetherget_current_site()is available before calling it. Alternatively, delay initialization until after WordPress has fully loaded by using theplugins_loadedhook.Example patch idea:
if (!function_exists('get_current_site')) {
$this->inited = false;
add_action('plugins_loaded', array($this, '_init'), 20);
return;
}Please provide an updated version of the plugin that resolves this critical bug.
Thank you.If Submitting to ww.wp.xz.cn Support Forum:
Use this variation:❗️Plugin Causes Fatal Error: Call to undefined function get_current_site()
I’m getting the following fatal error when trying to use the Seraphinite Accelerator plugin:
Fatal error: Uncaught Error: Call to undefined function get_current_site()
in /wp-content/plugins/seraphinite-accelerator/cache_obj.phpThis crashes the entire website. I believe the issue happens because the plugin attempts to call
get_current_site()during its initialization too early in the WordPress loading process.My Setup:- WordPress: 6.8.1
- PHP: 8.1
- Multisite: Enabled (subdomain)
The file
cache_obj.phptries to accessget_current_site()inside the_init()method, which runs before WordPress has defined that function.Proposed Fix:Delay initialization until
plugins_loadedor wrap the call with a function-exists check.Can anyone confirm this is a known bug? Or is there a working updated version of this plugin?
Thanks.
The topic ‘Fatal Error: Call to undefined function get_current_site() in Seraphinite Accele’ is closed to new replies.