AI Verified

Name

Elementor Failed Login

About

Return to the current page and add a variable to the URL after a failed login using the Elementor login widget

Language

PHP

Rating

Voted: 0 by 0 user(s)

How to Setup Snippet

Add this snippet and if you have a failed login it will return to the same page and add ?login=failed to the end of the URL Then using the dynamic conditions plugin you can display an alert box to show an error message

Codevault

sflwa

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.4

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

10/02/2024

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Potential vulnerability found : Remote Command Execution
Found on line : 7
Code : preg_replace('/?.*/', '', $referrer)
Vulnerable line : 3
Code : $referrer = $_SERVER['HTTP_REFERER']); // where did the post submission come from?

Found 1 vulnerabilities

Elementor Failed Login

 
                    
1add_action( 'wp_login_failed', 'elementor_form_login_fail' );
2function elementor_form_login_fail( $username ) {
3 $referrer = $_SERVER['HTTP_REFERER']; // where did the post submission come from?
4 // if there's a valid referrer, and it's not the default log-in screen
5 if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {
6 //redirect back to the referrer page, appending the login=failed parameter and removing any previous query strings
7 //maybe could be smarter here and parse/rebuild the query strings from the referrer if they are important
8 // wp_redirect(preg_replace('/?.*/', '', $referrer) . '/?login=failed' );
9 wp_redirect($referrer . '/?login=failed' );
10 exit;
11 }
12}

0

Related Snippets

Please see some snippets below related to this snippet..

Elementor

Unverified

0

Single Product Elementor styling inline Radio Variation

Added: 3 months ago

Last Updated: 3 months ago

Stylise the Single Product Variation Radio Buttons.

Elementor

AI Verified

1

PHP: Remove image sizes (controls) from Elementor image dropdowns

Added: 9 months ago

Last Updated: 9 months ago

<p>Since we disable the generation of images besides the original upload, the Elementor controls aren't relevant. This doesn't disable controls on all widgets, unfortunately — but it does remove them...

Elementor

Unverified

0

Single Product Elementor styling Radio Variation

Added: 3 months ago

Last Updated: 3 months ago

Stylise the Single Product Variation Radio Buttons.

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

Elementor

AI Verified

0

Elementor Failed Login

Added: 4 months ago

Last Updated: 4 months ago

Return to the current page and add a variable to the URL after a failed login using the Elementor login widget