Hi.
Use this code to disable it on any page that contains a certain string in the URL address. Edit the values inside the $disable_strings array to match your conditions. There are two values there now, but could be more separated by comma, or only one, without the comma then.
There is also another array $protect_strings which contains strings that if contained in the URL, the captcha will always work even if the disable strings are present. This is to make sure it works on wp-login.php even if we add some part at the end of the URL that contains disable strings.
add_action( 'plugins_loaded', 'disable_slc_on_some_pages' );
function disable_slc_on_some_pages() {
$disable_strings = Array( '/my-account/', '/some-other-example/' );
$protect_strings = Array( 'wp-login.php' );
foreach ( $protect_strings as $protect_string ) {
if ( strpos( $_SERVER['REQUEST_URI'], $protect_string ) !== false ) {
return;
}
}
foreach ( $disable_strings as $disable_string ) {
if ( strpos( $_SERVER['REQUEST_URI'], $disable_string ) !== false ) {
remove_filter( 'authenticate', 'slc_validate_login_form', 10, 3 );
remove_action( 'woocommerce_login_form', 'slc_woo_login_form_captcha', 9999999999 );
remove_action( 'login_form', 'slc_login_form_captcha', 9999999999 );
remove_filter( 'login_form_middle', 'slc_add_to_wp_login_form', 9999999999 );
break;
}
}
}
Regards.