0

Im trying to add captcha to my remember lost password form:

I've added the input with the lostpassword_form hook and is ok. now in the processing I need to add a error when captcha is invalid:

 add_action( 'lostpassword_post', 'processCaptcha' );

 public function processCaptcha()
 {
     if($_POST['captcha']!=$captcha){
       global $errors;     
       $errors->add('invalid', __('<strong>ERROR</strong>: invalid captcha.'));
     }
 }

When I try to catch the $error with empty or invalid username/email shows:

WP_Error Object
(
    [errors] => Array
        (
        )

    [error_data] => Array
        (
        )
)

Any idea how to fix it?

1

What happen if you use this instead ?

public function processCaptcha()
 {
     if($_POST['captcha']!=$captcha){
       global $errors;     
       $errors->add('invalid', '<strong>ERROR</strong>: invalid captcha.');
     }
 }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.