我正在尝试从我的前端使用contact-form-7 rest api,它在ReactJs上。当我将数据发布到api时,我面临以下问题。终点:http://example.com/wp-json/contact-form-7/v1/contact-forms/49/
{ "code":"wpcf7_forbidden","message":“您不能访问请求的联系人表单。”,"data":{ "status":403 }}
有没有人遇到过这个问题?或者我应该使用什么方法来处理这种情况。
发布于 2021-04-13 18:47:28
如果查看CF7代码(contact-form-7/includes/rest-api.php,第51行),
if ( current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
return true;
} else {
return new WP_Error( 'wpcf7_forbidden',
__( "You are not allowed to access the requested contact form.", 'contact-form-7' ),
array( 'status' => 403 )
);
}当访问表单的当前用户没有足够的权限时,将返回此消息。
https://stackoverflow.com/questions/67040004
复制相似问题