Hi– thanks for using Force Login!
Force Login restricts access to the REST API for authorized users only.
Try one of the following code snippets to allow the WP REST API to be publicly accessible again:
add_filter( 'rest_authentication_errors', '__return_true' );
Or
remove_filter( 'rest_authentication_errors', 'v_forcelogin_rest_access', 99 );
Thank you for the quick response.
Sorry, but where should this code be added? Also, what might be the difference in the two options?
Oops just re-read your note . snippets… i got it thanks
Tried both methods … getting a different error
{
“code”: “rest_forbidden_context”,
“message”: “Sorry, you are not allowed to create entries”,
“data”: {
“status”: 403
}
}
Hi–
where should this code be added?
You would add the code to your theme or child theme’s functions.php file.
what might be the difference in the two options?
The first example sets the REST authentication to always be true, or authenticated. Where as the second example removes the Force Login filter v_forcelogin_rest_access
which is what limits the REST API to only be accessible by logged-in users.
Tried both methods … getting a different error
Both methods successfully unlocked your REST API with Force Login. This new error you’re getting is not caused by or related to Force Login.
The API for formidable forms does not seem to work. I am calling it to add entries to a form.
This is now true again– that new error says, “Sorry, you are not allowed to create entries.” I would contact formidable forms about this new error.
Good luck!