diff --git a/includes/class-ayecode-connect-turnstile.php b/includes/class-ayecode-connect-turnstile.php index d0b1e42..e8c1cfc 100755 --- a/includes/class-ayecode-connect-turnstile.php +++ b/includes/class-ayecode-connect-turnstile.php @@ -199,7 +199,7 @@ private function init_hooks() { } else if ( $pagenow && in_array( $pagenow, array( 'wp-login.php', 'wp-register.php' - ) ) ) { // @todo test on sub domain install + ) ) || $this->is_wps_login_page() ) { // @todo test on sub domain install add_action( 'login_footer', array( $this, 'add_lazy_load_script' ) ); add_action( 'login_footer', array( $this, 'adjust_login_form_size_css' ) ); } else { @@ -976,6 +976,48 @@ public function verify_turnstile_keys() { wp_die(); } + + /** + * Check WPS Hide Login page. + * + * @since 1.4.10 + * + * @return bool True when WPS login page, else False. + */ + public function is_wps_login_page() { + if ( is_login() ) { + return true; + } + + if ( ! defined( 'WPS_HIDE_LOGIN_BASENAME' ) ) { + return false; + } + + if ( $slug = get_option( 'whl_page' ) ) { + $login_slug = $slug; + } else if ( ( is_multisite() && is_plugin_active_for_network( WPS_HIDE_LOGIN_BASENAME ) && ( $slug = get_site_option( 'whl_page', 'login' ) ) ) ) { + $login_slug = $slug; + } else if ( ! empty( $slug ) && $slug = 'login' ) { + $login_slug = $slug; + } else { + return false; + } + + $request_uri = ! empty( $_SERVER['REQUEST_URI'] ) ? rawurldecode( $_SERVER['REQUEST_URI'] ) : ''; + + if ( $request_uri && strpos( $request_uri, $login_slug ) !== false ) { + $current_parse_url = parse_url( $request_uri ); + $login_parse_url = parse_url( site_url( $login_slug, 'relative' ) ); + $current_path = ! empty( $current_parse_url['path'] ) ? trim( $current_parse_url['path'], "/" ) : ''; + $login_path = ! empty( $login_parse_url['path'] ) ? trim( $login_parse_url['path'], "/" ) : ''; + + if ( $current_path && $current_path == $login_path ) { + return true; + } + } + + return false; + } } // run diff --git a/readme.txt b/readme.txt index 03a359f..b45e980 100755 --- a/readme.txt +++ b/readme.txt @@ -81,6 +81,9 @@ If your host runs "mod security" on your hosting and has some specific additiona == Changelog == += 1.4.10 - 2025-08-TBD = +* Turnstile captcha is not working on WPS Hide Login page - FIXED + = 1.4.9 - 2025-08-07 = * Site auto disconnected when url contains www. - FIXED * Turnstile captcha support for UWP Mailerlite addon forms - ADDED