• Resolved Mohamed Taman

    (@mohamedtaman)


    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:189

    Issue:
    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’s WP_Object_Cache class assumes a Multisite environment and calls get_current_site() (a Multisite-only function) without checking is_multisite() or function_exists().

    Affected Code:
    In cache_obj.php, the _init() method tries to initialize $this->curSite using get_current_site(), which fails on single-site WordPress.

    This error occurs because the plugin’s WP_Object_Cache->_init() method calls get_current_site() too early — before WordPress has fully initialized the multisite environment.🔧 Steps to Reproduce:

    1. Install and activate the Seraphinite Accelerator plugin.
    2. Access any page on the site (including admin dashboard).
    3. 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 whether get_current_site() is available before calling it. Alternatively, delay initialization until after WordPress has fully loaded by using the plugins_loaded hook.

    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.php

    This 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.php tries to access get_current_site() inside the _init() method, which runs before WordPress has defined that function.Proposed Fix:

    Delay initialization until plugins_loaded or 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.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Fatal Error: Call to undefined function get_current_site() in Seraphinite Accele’ is closed to new replies.