1

In Wordfence documentation says:

"The filter “wordfence_ls_require_captcha” can be used to disable the CAPTCHA in circumstances of your choice. This may be useful for plugins that contain REST endpoints with authentication that should not require a CAPTCHA. Your filter should return false to bypass the CAPTCHA requirement when necessary, or otherwise true when the CAPTCHA should be required"

If I tried to make an API Call through JWT, I am getting an auth verification link via email and could not proceed to my flow. This API Call already has username:password for auth user. Thus, how could I use this filter

wordfence_ls_require_captcha

in order to disable the auth verification mail like Wordfence suggest in the documentation (email sent in the inbox, with verification link, in order to login - this is what I want to disable)?

*I already have installed a plugin that Disables all APIs Calls, for un-authorized users. So, this verification email is useless for now.

  • 1
    The question seems unclear to me. You say "how could I use this filter...in order to disable the auth verification mail like Wordfence suggest in his own doc...?". Wordfence docs you quoted above says that you can disable the CAPTCHA using that filter; it doesn't say you can disable the auth verification mail. – mircobabini Aug 18 '21 at 14:06

1 Answers1

3

Looking at the latest WordFence available version (7.5.5 at the time of writing) seems that the email with subject "Login Verification Required" is sent only under two conditions (AND):

  • $requireCAPTCHA = true
  • $performVerification = true

Since we can make $requireCAPTCHA = false using that filter, this is how you want to deactivate that email:

add_filter( 'wordfence_ls_require_captcha', '__return_false' );
mircobabini
  • 544
  • 2
  • 13
  • ok @microbabini ! give some time to test your code! I have edited my question a little bit. I just want to disable the verification email Wordfence send, in order to login.. I did not know the syntax of this add_filter - hook. Thus, I will check it and let you know – Kiriakos Grhgoriadhs Aug 18 '21 at 16:56
  • The syntax is straightforward: the first param is the filter you want to hook to, the second param is the function you want to call (in your case, a simple callback which returns false, which is a common case in wordpress and there's a __return_false() function in core). – mircobabini Aug 18 '21 at 17:24
  • You are correct! Finally got this working.. Now I could move on. thanks! – Kiriakos Grhgoriadhs Aug 19 '21 at 18:08