Home > OS >  Fatal error: Uncaught ReflectionException: Method get_site_editor_type does not exist
Fatal error: Uncaught ReflectionException: Method get_site_editor_type does not exist

Time:08-09

Literally after doing nothing on the site, after several days of non-use, when trying to log in, such an error appears:

Fatal error: Uncaught ReflectionException: Method get_site_editor_type does not exist in /usr/home/midas/domains/mydomain.com/public_html/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php:45

theme-document.php:

protected static function get_site_editor_type_bc() {
    static $types = [];

    $class_name = static::get_class_full_name();

    $reflection = new \ReflectionClass( $class_name ); //45 line
    $method = $reflection->getMethod( 'get_site_editor_type' );

    // It's own method, use it.
    if ( $class_name === $method->class ) {
        return static::get_site_editor_type();
    }

    // _deprecated_function( 'get_name', '3.0.0', 'get_site_editor_type' );

    // Fallback, get from class instance name (with caching).
    if ( isset( $types[ $class_name ] ) ) {
        return $types[ $class_name ];
    }

    $instance = new static();

    $types[ $class_name ] = $instance->get_name();

    return $types[ $class_name ];
}

How can I resolve this?

CodePudding user response:

I also had this issue today and have resolved it by rolling back the free version of Elementor, it's due to a bug in the recent update.

CodePudding user response:

Change the code

$reflection = new \ReflectionClass( $class_name ); //45 line
$method = $reflection->getMethod( 'get_site_editor_type' );

// It's own method, use it.
if ( $class_name === $method->class ) {
    return static::get_site_editor_type();
}

By

if (method_exists($class_name, "get_site_editor_type")) {
    $reflection = new \ReflectionClass( $class_name );
    $method = $reflection->getMethod( 'get_site_editor_type' );
    
    // It's own method, use it.
    if ( $class_name === $method->class ) {
        return static::get_site_editor_type();
    }
}
  • Related