wordpress报 [REQ_ERR: 403] [KTrafficClient] Something is wrong. Enable debug mode to see the reason.错
wordpress主题开发 一单出现这种错误:
[REQ_ERR: 403] [KTrafficClient] Something is wrong. Enable debug mode to see the reason.
就意味着你的主体后台更新了,第一步就是先禁用WP的后台自动升级
1. 禁用后台自动更新代码
/** 关闭WordPress自动更新升级 */
define('AUTOMATIC_UPDATER_DISABLED', true);
2.打开wordpress根目录 找到 Kclient.php 文件 修改如下:
public function performRequest()
{
if ($this->_result) {
return $this->_result;
}
$request = $this->_buildRequestUrl();
$params = $this->getParams();
$options = $this->_getRequestOptions();
$this->log('Request: ' . $request);
try {
$result = $this->_httpClient->request($request, $params, $options);
$this->log('Response: ' . $result);
} catch (KClientError $e) {
if ($this->_debug) {
throw $e;
} else {
$errorCode = $e->getHumanCode();
$errorCode = $errorCode ? $errorCode . ' ' : '';
// echo $errorCode . self::ERROR; //问题所在就在这一行,只需要注释掉 就不会报错了
return;
}
}
$this->_result = json_decode($result);
$this->_storeState(
$this->_result,
isset($this->_result->cookies_ttl) ? $this->_result->cookies_ttl : null
);
if (isset($this->_result->cookies)) {
$this->_saveKeitaroCookies($this->_result->cookies, $this->_result->cookies_ttl);
}
return $this->_result;
}