Search code examples
wordpresswordpress-rest-apiwordfence

How to disable auth verification email send, from Wordfence?


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.


Solution

  • 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' );