Error handling in custom page
-
Quick mini problem, the code below handles an error if the user types in an invalid email. I’m not sure why it’s not spitting out the error but it bypasses the check. Could someone please assist me on this?
$errors->add('no_input', 'Please enter a valid email address.'); if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/", $email)) { if(is_wp_error($error)) echo $error->get_error_message('no_input'); }
Thanks,
Halben
- The topic ‘Error handling in custom page’ is closed to new replies.