Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add query string if failed login with Elementor Pro Login Form
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.