Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

What happen if you use this instead ?

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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