【问题标题】:Fatal error: Uncaught ReflectionException: Method get_site_editor_type does not exist致命错误:未捕获的 ReflectionException:方法 get_site_editor_type 不存在
【发布时间】:2022-11-11 02:24:46
【问题描述】:

从字面上看,在网站上什么都不做,几天不使用后,尝试登录时,出现这样的错误:

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

主题文档.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 ];
}

我该如何解决这个问题?

【问题讨论】:

  • 你设法解决这个问题吗?我在这里挣扎。我尝试回滚 elementor 版本,并注释掉这些行...我可以在 elementor 主题编辑器中按原样查看我的页面,但是在我的实时站点上,它显示 404 not found 页面:(

标签: wordpress elementor


【解决方案1】:

更改代码

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

经过

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

【讨论】:

  • 任何逐行检查代码的人,OP 只添加了 if 条件。
  • 非常感谢陛下。你治好了我的头痛
【解决方案2】:

我以与 Mayous 类似的方式解决了这个问题。我只是在/wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php 中注释掉了这一行。 所以第 46 行是

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

将其更改为

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

【讨论】:

  • 没用。它下面有一行使用 $reflection ,所以现在会引发错误。
  • 为我工作。我发现 Elementor 一直在推送错误的版本非常令人不安。
  • 有趣的。也许有两个错误版本,这修复了其中一个错误版本。
【解决方案3】:

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

注释掉第 47 行

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

等待修复更新。

【讨论】:

  • 没用。它下面有一行使用 $reflection ,所以现在会引发错误。
【解决方案4】:

我今天也遇到了这个问题,并通过回滚 Elementor 的免费版本来解决它,这是由于最近更新中的一个错误。

【讨论】:

  • 你好,免费版是什么版本号?您是否尝试回滚到任何付费版本?
【解决方案5】:

就我而言,网站因管理员(登录用户)而崩溃,因此无法登录。

我的解决方案是关闭“Elementor pro”(使用我的 wp 主机的管理控制台),然后我可以登录并手动上传 Elementor pro 的新版本。

由于无法禁用插件,我想编辑代码也可以,只需注释掉第 47 行:

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

【讨论】:

    猜你喜欢
    • 2021-12-10
    • 2020-01-03
    • 2015-06-20
    • 1970-01-01
    • 2016-08-19
    • 2018-01-03
    • 1970-01-01
    • 2016-10-28
    • 2021-06-21
    相关资源
    最近更新 更多