Last active
May 27, 2022 13:13
-
-
Save victormattosvm/4a1781413816fb7aa8733d5c8ff6920a to your computer and use it in GitHub Desktop.
Fix for "anr_error" when using WPGraphQL or WP REST API with Captcha4WP (old Advanced Nocaptcha & Invisible Captcha)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This code disables the Captcha verification when using WPGraphQL or WP REST API | |
* It fixes the "anr_error" issue. | |
* | |
* Put this code in your functions.php | |
*/ | |
add_action( | |
'rest_api_init', | |
function() { | |
if ( class_exists( 'anr_captcha_class' ) ) { | |
remove_filter('authenticate', array( \anr_captcha_class::init(), 'login_verify'), 999, 3); | |
} | |
} | |
); | |
add_action( | |
'init_graphql_request', | |
function() { | |
if ( class_exists( 'anr_captcha_class' ) ) { | |
remove_filter('authenticate', array( \anr_captcha_class::init(), 'login_verify'), 999, 3); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment