Wojciech
Wojciech

Reputation: 643

Fatal error: Uncaught ReflectionException: Method get_site_editor_type does not exist

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?

Upvotes: 64

Views: 53844

Answers (5)

omadawn
omadawn

Reputation: 309

In my case, the site crashed for admins (logged in users), so was impossible to log in.

My solution was to shut down "Elementor pro" (using the admin console of my wp hosting), and then I could login and manually upload a new version of Elementor pro.

With no way to disable the plugin, I guess editing the code would also work, just comment out line 47 in:

/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php

Upvotes: 2

Mayous
Mayous

Reputation: 2158

Permanent fix: Upload a fresh copy of elementor-pro to the plugins folder.

Temporary fix:

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

Upvotes: 135

Cecily Urizar-Faught
Cecily Urizar-Faught

Reputation: 349

I solved this similarly to Mayous. I simply commented out the line in /wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php. So line 46 was

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

Changed it to

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

Upvotes: 34

halkibsi
halkibsi

Reputation: 365

Go to: /wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php

Comment out line 47

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

Wait for a fix to update.

Upvotes: 11

Byron Jacobs
Byron Jacobs

Reputation: 51

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.

Upvotes: 5

Related Questions