首页 > 解决方案 > 更新到最新的 wordpress 5.0 后,联系 7 表格导致我的网站出现错误

问题描述

升级到 5.0 版后,我的网站缺少一些样式,昨天我检查网站时收到了一封来自 wordpress 的电子邮件,其中包含此错误,它的结构不正确,也缺少样式。

我没有遇到这个错误,所以当我得到它时,我试图删除插件联系表格 7 表格并重新安装它,但问题仍然存在。

这是我从日志中得到的消息

Error Details
=============
An error of type E_PARSE was caused in line 352 of the file /home/****/public_html/wp-content/plugins/contact-form-7/modules/constant-contact.php. Error message: syntax error, unexpected 'pu' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

这是有问题的功能

          public function create_contact( $properties ) {
        $endpoint = 'https://api.cc.email/v3/contacts';

        $request = array(
            'method' => 'POST',
            'headers' => array(
                'Accept' => 'application/json',
                'Content-Type' => 'application/json; charset=utf-8',
            ),
            'body' => json_encode( $properties ),
        );

        $response = $this->remote_request( $endpoint, $request );

        if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) {
            if ( WP_DEBUG ) {
                $this->log( $endpoint, $request, $response );
            }

            return false;
        }
    }

第 352 行是函数开始的地方。

我已删除公共和清除缓存,但该站点仍未修复。

在同一个文件的第 638 行还有一个空的 __construct。

public function __construct() {
    }

我希望有人能尽快帮助我解决这个问题。

标签: wordpressloggingerror-handlingcontact-form-7

解决方案


您可以发布发生错误的第 352 行吗?


推荐阅读