0

When I submit a form with wrong id's, the url is set like this :

url-test.com/connexion/?login-failed

I want to trigger login-failed to make conditions.

Here's my code, but it does not work

$login_failed = $_GET['login-failed'];

if($login_failed) {
    $error = 'Oups failed';
}

//My form
<?php wp_login_form(); ?>
<p><?php if(isset($error)) {echo $error;} ?></p>

Thanks for your help !

2
  • 1
    What does not work? Is the error not showing? Is the form not showing? Please explain / clarify the issue. Commented Jul 31, 2015 at 8:14
  • The error message is not showing Commented Jul 31, 2015 at 8:16

2 Answers 2

3
if(isset($login_failed)) {
    $error = 'Oups failed';
}

You have to check that it's isset.

Sign up to request clarification or add additional context in comments.

Comments

0

Your code isn't working, because you're store the value of $_GET['login-failed], but actually there's no value. If you change ?login-failed to ?login-failed=1, it should works.

Otherwise, you should check if variable isset, e.g:

$login_failed = isset( $_GET['login-failed'] ) ? true : false;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.