We had this same issue, @maria003, you need to whitelist the call made by contact 7 form, by adding in a few lines to the disable-wp-rest-api.php file in the plugin (apologies @specialk if this is not the correct or intended use of the plugin, also great plugin, thanks ?? saved me a lot of headaches):
#in disable-wp-rest-api.php update the disable_wp_rest_api function with something like this:
function disable_wp_rest_api($access) {
# note, your url here is probably different! check the console log for where the REST request is going
$allowed_uris = ["/wp-json/contact-form-7/v1/contact-forms/4/feedback", "/wp-json/contact-form-7/v1/contact-forms/4/feedback/"];
if (!is_user_logged_in() && !(in_array($_SERVER['REQUEST_URI'], $allowed_uris))) {
$message = apply_filters('disable_wp_rest_api_error', __('REST API restricted to authenticated users.', 'disable-wp-rest-api'));
return new WP_Error('rest_login_required', $message, array('status' => rest_authorization_required_code()));
}
if (is_user_logged_in() && !(in_array($_SERVER['REQUEST_URI'], $allowed_uris))) {
$message = apply_filters('disable_wp_rest_api_error', __('REST API restricted.', 'disable-wp-rest-api'));
return new WP_Error('access_denied', $message, array('status' => rest_authorization_required_code()));
}
return $access;
}
-
This reply was modified 4 years ago by atomicacorn. Reason: added comment to note the allowed uri may be different for the op