-
-
Save dexit/e367cdbda7e054e898166de47898a7a6 to your computer and use it in GitHub Desktop.
Add query string if failed login with Elementor Pro Login Form
This file contains hidden or 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 | |
add_action( 'wp_login_failed', 'yanco_elementor_form_login_fail' ); | |
function yanco_elementor_form_login_fail( $username ) { | |
// where did the post submission come from? | |
$referrer = $_SERVER['HTTP_REFERER']; | |
// if there's a valid referrer, and it's not the default log-in screen | |
if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) { | |
//redirect back to the referrer page, appending the login=failed parameter | |
$redirect_to = add_query_arg( array( | |
'login' => 'failed', | |
), $referrer ); | |
wp_redirect( $redirect_to ); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment