首页 > 解决方案 > 我的 Elementor 网站面临致命错误致命错误:必须保护 Molla_Element_Section::get_html_tag() 的访问级别

问题描述

我的网站显示的错误如下:

致命错误:Molla_Element_Section::get_html_tag() 的访问级别必须受到保护(如 Elementor\Element_Section 类)或 web.com/public_html/wp-content/plugins/molla-core/elementor/elements/section.php 中的较弱第 3668 行

根据上面的目录,第 3668 行的代码如下:

/**
 * Get HTML tag.
 *
 * Retrieve the section element HTML tag.
 *
 * @since 1.0
 */
private function get_html_tag() {
    $html_tag = $this->get_settings( 'html_tag' );

    if ( empty( $html_tag ) ) {
        $html_tag = 'section';
    }

    return $html_tag;
}

请帮我解决这个问题,我尝试使用 elementor 版本(降级以检查这是否是问题)但没有帮助。

标签: phpwordpresswordpress-themingelementor

解决方案


查看 php 文档中的 Object Inheritance:方法、属性和常量的可见性可以放宽,例如可以将受保护的方法标记为公共,但不能限制它们,例如将公共属性标记为私有。

Molla_Element_Section 类很可能继承自 Elementor\Element_Section 并覆盖方法 get_html_tag。但它使用了错误的访问级别。get_html_tag 方法不能是“私有的”,它必须是“受保护的”或“公共的”。正如文件所说,可见性不能受到限制。


推荐阅读