[Solved] Wordpress fatal error: Uncaught ReflectionException: Method get_site_editor_type does not exist

Wordpress Mohit Mozumder

Problem:

When I try to login to my wordpress site I found this error continuously-

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 solve this issue.


Solution 1:

You also can  simply comment out the line in /wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php. Line 46 was

$method = $reflection->getMethod( 'get_site_editor_type' );

Comment out it to

//$method = $reflection->getMethod( 'get_site_editor_type' );


Solution 2:

Replace the code in your theme-document.php-

$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();
    }
}


Thank you for reading the article. If you face any other problem feel free to ask us.